# onFileReceived call twice on FileUpload component

**URL:** <https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563>\
**Category:** Ignition Early Access\
**Created:** [May 8, 2020, 10:37am UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563 "2020-05-08T10:37:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [May 8, 2020, 10:37am UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/1 "2020-05-08T10:37:30Z")

</div>

Hello  
I put a FileUpload component in a view and try to upload a single file. In onFileReceived event I simply print some info on console.  
Every thing works just fine except the event fire twice each times I upload a file.  
If I try to load 3 files for each file the event fire twice so I totally have 6 fire event for just 3 files.

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [May 8, 2020, 3:42pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/2 "2020-05-08T15:42:59Z")

</div>

> [@nader.chinichian](#):
>
> put a FileUpload component in a view and try to upload a single file. In onFileReceived event I simply print some info on console.  
> Every thing works just fine except the event fire twice each times I upload a file.  
> If I try to load 3 files for each file the event fire twice so I totally have 6 fire event for just 3

Hey Nader,

I was having the same issue!

> [@\[IGN-8219\] Perspective File Upload onFileReceived being called twice](http://forum.inductiveautomation.com/t/possible-bug-perspective-file-upload-onfilereceived-being-called-twice/32472):
>
> Hello, I'm using the perspective FileUpload Component to upload images to a database using the following code in the OnFileReceived component event: query = 'INSERT INTO [Table] ([ID],[Name],[Image]) VALUES (?,?,?)' system.db.runPrepUpdate(query, [self.view.params.ID, event.file.name, event.file.getBytes()], 'DB') It works in that it uploads the image to the database but for some reason the onFileReceived event is being called twice for every image that is uploaded. It's happening in a brows…

@jball Looks like i'm not the only one with this problem

---

<div class="post-metadata">

**Author:** ![jball](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jball/32/11128_2.png) [@jball](https://forum.inductiveautomation.com/u/jball)\
**Post date:** [May 8, 2020, 4:27pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/3 "2020-05-08T16:27:06Z")

</div>

@nader.chinichian, @Matthew.gaitan, thanks for reporting. I’ll log a bug so we can diagnose. For documentation, can you let me know the versions of Ignition you guys are on?

---

<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:** [May 8, 2020, 5:58pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/4 "2020-05-08T17:58:08Z")

</div>

Is there any chance one of you could send either Josh or myself a View (view.json) which is experiencing this issue? Or post one here?

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [May 8, 2020, 7:25pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/5 "2020-05-08T19:25:00Z")

</div>

Here is the view. Hope this helps!

[test.json](https://forum.inductiveautomation.com/uploads/short-url/lbTwBn3B19DqTPNwQMeC1DoWdbT.json) (4.4 KB)

Edit: We’re on 8.0.11 RC1

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [May 9, 2020, 5:24am UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/6 "2020-05-09T05:24:10Z")

</div>

My client use 8.0.6.

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [May 9, 2020, 5:28am UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/7 "2020-05-09T05:28:37Z")

</div>

[TOTAL\_2020-05-09\_0957.zip](https://forum.inductiveautomation.com/uploads/short-url/weCOWG81xXpQgQ8N5ZJEzdBaUoe.zip) (4.8 KB)

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [May 10, 2020, 5:11pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/8 "2020-05-10T17:11:59Z")

</div>

Hi  
Can you confirm it is bug or we made something wrong?

---

<div class="post-metadata">

**Author:** ![jball](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jball/32/11128_2.png) [@jball](https://forum.inductiveautomation.com/u/jball)\
**Post date:** [May 11, 2020, 4:00pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/9 "2020-05-11T16:00:44Z")

</div>

Cody and I both tried to replicate this in the past when it was first reported, but weren’t able to create the behavior. Hopefully with the views you and Mathew provided, we can create an example that exhibits the behavior so we can diagnose it.

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [May 12, 2020, 6:54am UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/10 "2020-05-12T06:54:42Z")

</div>

By any change did you test it in v8.0.6?

---

<div class="post-metadata">

**Author:** ![ankitkarwa21](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@ankitkarwa21](https://forum.inductiveautomation.com/u/ankitkarwa21)\
**Post date:** [May 12, 2020, 9:55pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/11 "2020-05-12T21:55:26Z")

</div>

Seeing same issue in 8.0.12

---

<div class="post-metadata">

**Author:** ![jball](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jball/32/11128_2.png) [@jball](https://forum.inductiveautomation.com/u/jball)\
**Post date:** [May 12, 2020, 10:19pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/12 "2020-05-12T22:19:05Z")

</div>

@nader.chinichian, @Matthew.gaitan, Cody and I tried to replicate this behavior with both of your views and were unsuccessful. The component and the eventing worked correctly in both cases. Cody did test on 8.0.6 to rule out that particular version of Ignition as a culprit. I don’t believe the issue lies in the component/view configuration.

Just to rule cache out as an issue, can you clear your ignition cache and retest?

[https://support.inductiveautomation.com/index.php?/Knowledgebase/Article/View/112/2/how-to-clear-client-ignition-cache-and-java-cache#clear-client-cache](https://support.inductiveautomation.com/index.php?/Knowledgebase/Article/View/112/2/how-to-clear-client-ignition-cache-and-java-cache#clear-client-cache)

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [May 12, 2020, 10:36pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/13 "2020-05-12T22:36:05Z")

</div>

I cleared out my local cache and am still having the same issue.

Is there any cache or anything that may possibly need to be cleared out on the gateway?

---

<div class="post-metadata">

**Author:** ![jball](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jball/32/11128_2.png) [@jball](https://forum.inductiveautomation.com/u/jball)\
**Post date:** [May 12, 2020, 10:51pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/14 "2020-05-12T22:51:39Z")

</div>

By “local cache”, do you mean the Ignition client cache (from the article in the link above)?

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [May 12, 2020, 10:52pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/15 "2020-05-12T22:52:50Z")

</div>

yes. the .ignition folder located within my user directory

---

<div class="post-metadata">

**Author:** ![jball](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jball/32/11128_2.png) [@jball](https://forum.inductiveautomation.com/u/jball)\
**Post date:** [May 12, 2020, 10:57pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/16 "2020-05-12T22:57:46Z")

</div>

Darn; that’s a shame that didn’t work. Other things to try:

1. Clear all browser cache.
2. Restart the gateway.
3. Test in an icognito window (following a gateway restart).

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [May 12, 2020, 11:12pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/17 "2020-05-12T23:12:46Z")

</div>

Upon importing my test.json file i uploaded for you guys the view didn’t have the same issue. I had tried this previously but seems like clearing the cache was the key.

Thank you for the help!

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [May 13, 2020, 6:25am UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/18 "2020-05-13T06:25:18Z")

</div>

Hi Joshua  
If clearing cache solve the problem can you make it independent from it?  
In future I can’t control end users computer cache.

---

<div class="post-metadata">

**Author:** ![ankitkarwa21](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@ankitkarwa21](https://forum.inductiveautomation.com/u/ankitkarwa21)\
**Post date:** [May 13, 2020, 8:52pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/19 "2020-05-13T20:52:56Z")

</div>

Clearing out the cache resolved the issue for me too.

And agree with @nader.chinichian ,would be helpful to make it independent of cache.

---

<div class="post-metadata">

**Author:** ![PerryAJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/perryaj/32/3281_2.png) [@PerryAJ](https://forum.inductiveautomation.com/u/PerryAJ)\
**Post date:** [May 13, 2020, 11:06pm UTC](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563/20 "2020-05-13T23:06:21Z")

</div>

When you say cache, was it browser cache, or the `~/.ignition` cache folder?

[Next page](https://forum.inductiveautomation.com/t/onfilereceived-call-twice-on-fileupload-component/34563.md?page=2)
