# \[IGN-8219\] Perspective File Upload onFileReceived being called twice

**URL:** <https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472>\
**Category:** Ignition\
**Tags:** database, ignition80, perspective\
**Created:** [February 20, 2020, 8:57pm UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472 "2020-02-20T20:57:48Z")\
**Posts on this page:** 16\
**Page:** 1

<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:** [February 20, 2020, 8:57pm UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/1 "2020-02-20T20:57:48Z")

</div>

Hello,

I'm using the perspective FileUpload Component to upload images to a database using the following code in the OnFileReceived component event:

```auto
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 browser as well as in the perspective app.

Any help would be appreciated.

Thank you,  
Matthew

---

<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:** [February 24, 2020, 5:59pm UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/2 "2020-02-24T17:59:07Z")

</div>

Hi @Matthew.gaitan, that’s not a behavior that we’ve seen before. Just to debug, have you tried making a sample view with just the File Upload component (separate of the instance where you are seeing this error) and logging to the console on upload? If you’re still seeing that error with that sample view, please post back, but I imagine there is some type of duplicate logic somewhere that is causing what you are seeing.

---

<div class="post-metadata">

**Author:** ![Jake\_Geers](https://avatars.discourse-cdn.com/v4/letter/j/9fc348/32.png) [@Jake\_Geers](https://forum.inductiveautomation.com/u/Jake_Geers)\
**Post date:** [August 18, 2023, 4:59pm UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/3 "2023-08-18T16:59:03Z")

</div>

It looks like onFileReceived fires twice in Firefox but not IOS. Adding a system.perspective.print and no other code results in two logs in the console.

---

<div class="post-metadata">

**Author:** ![joshdunstan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joshdunstan/32/43306_2.png) [@joshdunstan](https://forum.inductiveautomation.com/u/joshdunstan)\
**Post date:** [September 12, 2023, 4:38am UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/4 "2023-09-12T04:38:12Z")

</div>

I'm in the same boat here, using edge 116.0.1938.76 on windows 10, Ignition 8.1.31.

The onFileReceived is firing twice off the upload file component.

---

<div class="post-metadata">

**Author:** ![joshdunstan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joshdunstan/32/43306_2.png) [@joshdunstan](https://forum.inductiveautomation.com/u/joshdunstan)\
**Post date:** [September 12, 2023, 4:43am UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/5 "2023-09-12T04:43:31Z")

</div>

I easily get around it by modifying the code to check the filename to ensure we don't do the same file twice in a row:

```
def runAction(self, event):
	# Grab the file name and data
	filename = event.file.name
	filedata = event.file.getString()
	
    # Check if this file has just been uploaded - to stop a double import (potential platform/browser bug)
	if filename <> self.custom.filename:
		# Call the import function on the table
		self.parent.parent.getChild("Table").importCSV(filename, filedata)
		self.custom.filename = filename
	else:
		self.custom.filename = ''

```

---

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [October 17, 2023, 5:29am UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/6 "2023-10-17T05:29:03Z")

</div>

I'm seeing this behavior in Chrome in 8.1.31.

 ![java_5TcX3Mivtt](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/2/c2e66c3eec1716b115627b196c2b6cebae9d6d0e.png)

![chrome_hIYTOtlQLK](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/9/798f105db0088114cca0e74e24800b8f37ad2f76.gif)

---

<div class="post-metadata">

**Author:** ![Ken\_Pace](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ken_pace/32/36092_2.png) [@Ken\_Pace](https://forum.inductiveautomation.com/u/Ken_Pace)\
**Post date:** [October 17, 2023, 3:34pm UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/7 "2023-10-17T15:34:40Z")

</div>

Thanks for the reports, we're tracking this bug.

---

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [November 28, 2023, 9:59am UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/8 "2023-11-28T09:59:19Z")

</div>

Same problem here:  
Ignition **8.1.31 (b2023081007)**  
Edge **Version 119.0.2151.72**

Thanks @joshdunstan for sharing your workaround!

---

<div class="post-metadata">

**Author:** ![Pappu\_Gupta](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@Pappu\_Gupta](https://forum.inductiveautomation.com/u/Pappu_Gupta)\
**Post date:** [December 6, 2023, 3:02pm UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/9 "2023-12-06T15:02:21Z")

</div>

Did you found any solution for that? I am also getting the exact issues.

---

<div class="post-metadata">

**Author:** ![craigb](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@craigb](https://forum.inductiveautomation.com/u/craigb)\
**Post date:** [December 6, 2023, 3:05pm UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/10 "2023-12-06T15:05:01Z")

</div>

Looks like this was fixed in the most recent nightly.

> [@Nightly 8.1 Changelogs - 2023](https://forum.inductiveautomation.com/t/nightly-8-1-changelogs-2023/68524/176):
>
> Nightly Changelog: 8.1.36-SNAPSHOT-b20231205 Perspective Perspective IGN-8219: Perspective: File Upload Component’s onFileReceived event unexpectedly fires twice when a small file is uploaded Fixed book keeping mistake related to the File Upload component and small file uploads.

---

<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:** [December 6, 2023, 4:03pm UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/11 "2023-12-06T16:03:40Z")

</div>

It has indeed been fixed, but there is some question as to whether the content made it into the nightly. There was an expedited release yesterday (8.1.35, which contained only one important fix which was a problem in 8.1.34), and our release mechanisms might not have caught up. It will absolutely be part of the 8.1.36 release.

---

<div class="post-metadata">

**Author:** ![Pappu\_Gupta](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@Pappu\_Gupta](https://forum.inductiveautomation.com/u/Pappu_Gupta)\
**Post date:** [December 7, 2023, 12:17pm UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/12 "2023-12-07T12:17:32Z")

</div>

Initially, i am using the size of file \<30kb so i am getting issue. Then i maintain the size of same image file between \>500kb &\<550kb but still same issue is happening.  
Any suggestion what size of file should be there so that the event can't fire twicely.

---

<div class="post-metadata">

**Author:** ![Christian\_Mayne](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christian_mayne/32/73325_2.png) [@Christian\_Mayne](https://forum.inductiveautomation.com/u/Christian_Mayne)\
**Post date:** [February 17, 2026, 1:51pm UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/13 "2026-02-17T13:51:14Z")

</div>

This bug is still an issue for small files in 8.3.3.

---

<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 17, 2026, 3:45pm UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/14 "2026-02-17T15:45:23Z")

</div>

Could you expand a bit more? Is this a consistent behavior? Could you provide a file which you’ve found results in this behavior? We have testing in place to verify we don’t see this, and I’d be curious to see why the testing is not sufficient to see this behavior

---

<div class="post-metadata">

**Author:** ![Christian\_Mayne](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christian_mayne/32/73325_2.png) [@Christian\_Mayne](https://forum.inductiveautomation.com/u/Christian_Mayne)\
**Post date:** [February 17, 2026, 5:08pm UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/15 "2026-02-17T17:08:26Z")

</div>

The behavior is consistent with a few small files I have tried. The files are small SVGs that are around 6kb. I can’t upload the file to the forum, but I can send it to you directly if you PM me.

---

<div class="post-metadata">

**Author:** ![Christian\_Mayne](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christian_mayne/32/73325_2.png) [@Christian\_Mayne](https://forum.inductiveautomation.com/u/Christian_Mayne)\
**Post date:** [February 19, 2026, 9:20pm UTC](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/16 "2026-02-19T21:20:21Z")

</div>

As an update, I worked with @cmallonee , niether of us could replicate this issue. I originally had the issue from the context of the designer interface and was connected to the gateway via VPN and there may have been a substantial amount of latency between the session and the gateway.
