# \[IGN-3351\]Reset FileUpload component from script

**URL:** <https://forum.inductiveautomation.com/t/ign-3351-reset-fileupload-component-from-script/57362>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 18, 2022, 3:23pm UTC](https://forum.inductiveautomation.com/t/ign-3351-reset-fileupload-component-from-script/57362 "2022-03-18T15:23:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe\_Kelly](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joe_kelly/32/30990_2.png) [@Joe\_Kelly](https://forum.inductiveautomation.com/u/Joe_Kelly)\
**Post date:** [March 18, 2022, 3:23pm UTC](https://forum.inductiveautomation.com/t/ign-3351-reset-fileupload-component-from-script/57362/1 "2022-03-18T15:23:28Z")

</div>

Is there a way to invoke the “clear uploads” button on the File Upload perspective component via scripting?

I’m working on a form and the user uploads a file, but after they click the submit button, I want the uploads to clear automatically.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 18, 2022, 3:25pm UTC](https://forum.inductiveautomation.com/t/ign-3351-reset-fileupload-component-from-script/57362/2 "2022-03-18T15:25:04Z")

</div>

Not currently, but I’ve attached you to the existing ticket for this feature, which will help raise its priority.

---

<div class="post-metadata">

**Author:** ![Joe\_Kelly](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joe_kelly/32/30990_2.png) [@Joe\_Kelly](https://forum.inductiveautomation.com/u/Joe_Kelly)\
**Post date:** [May 3, 2022, 2:14pm UTC](https://forum.inductiveautomation.com/t/ign-3351-reset-fileupload-component-from-script/57362/3 "2022-05-03T14:14:02Z")

</div>

I don’t know if we can upgrade the priority of this, but my form is causing duplicate files to be sent to the database because there’s not a way (that I know of) to clear the uploads from a script.

When the user taps the “submit” button, the script send all of the form details (including any uploaded file) to the database, and when it finished the script, it runs a “clear form” script to clear the data, but I can’t clear the uploaded files, so then the next entry has the previous entry’s uploaded file.

Thanks!

---

<div class="post-metadata">

**Author:** ![alan.s.kinnaman](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@alan.s.kinnaman](https://forum.inductiveautomation.com/u/alan.s.kinnaman)\
**Post date:** [June 2, 2022, 10:53pm UTC](https://forum.inductiveautomation.com/t/ign-3351-reset-fileupload-component-from-script/57362/4 "2022-06-02T22:53:40Z")

</div>

I’d also like the ability to perform this reset programmatically. In my use case, we do some validation on an Excel document that the user uploads. If the validation fails, we show an error message, but the FileUpload component still shows that the upload was successful. This could be confusing to end users, so I’d like to reset the component’s state if the validation fails.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 2, 2022, 11:01pm UTC](https://forum.inductiveautomation.com/t/ign-3351-reset-fileupload-component-from-script/57362/5 "2022-06-02T23:01:37Z")

</div>

This will be possible in 8.1.18. Full release is expected mid June.

---

<div class="post-metadata">

**Author:** ![alan.s.kinnaman](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@alan.s.kinnaman](https://forum.inductiveautomation.com/u/alan.s.kinnaman)\
**Post date:** [June 2, 2022, 11:23pm UTC](https://forum.inductiveautomation.com/t/ign-3351-reset-fileupload-component-from-script/57362/6 "2022-06-02T23:23:22Z")

</div>

Awesome. Glad to hear that. Thanks, Paul.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 22, 2023, 5:48pm UTC](https://forum.inductiveautomation.com/t/ign-3351-reset-fileupload-component-from-script/57362/8 "2023-02-22T17:48:34Z")

</div>

It depends on where you're trying to do this from, but you need to reference the File Upload component in some manner, and then invoke the [component function](https://docs.inductiveautomation.com/display/DOC81/Perspective+-+File+Upload#:~:text=object-,Component%20Functions,-.clearUploads()):

```auto
# from a sibling component, and assuming your File Upload has not been renamed
self.getSibling("FileUpload").clearUploads()

# from a script which belongs to the File Upload component
self.clearUploads()

```

---

<div class="post-metadata">

**Author:** ![avantica](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@avantica](https://forum.inductiveautomation.com/u/avantica)\
**Post date:** [April 15, 2023, 7:35am UTC](https://forum.inductiveautomation.com/t/ign-3351-reset-fileupload-component-from-script/57362/10 "2023-04-15T07:35:38Z")

</div>

This is only working in a session and does not fire in a designer session

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 15, 2023, 1:00pm UTC](https://forum.inductiveautomation.com/t/ign-3351-reset-fileupload-component-from-script/57362/11 "2023-04-15T13:00:10Z")

</div>

> [@avantica](#):
>
> does not fire in a designer session

And? There are many aspects of both Vision and Perspective that do not function in the designer. This, in itself, is not a bug. Simply a limitation of a partial runtime intended for graphical design.

---

<div class="post-metadata">

**Author:** ![tyler.robertson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tyler.robertson/32/18299_2.png) [@tyler.robertson](https://forum.inductiveautomation.com/u/tyler.robertson)\
**Post date:** [June 17, 2024, 11:23pm UTC](https://forum.inductiveautomation.com/t/ign-3351-reset-fileupload-component-from-script/57362/12 "2024-06-17T23:23:10Z")

</div>

And? And.. I for one was happy that person mentioned it, just so I was aware at the onset.  
...And for what it's worth, just worked fine in a designer session for me.
