# Upload component gets file Received Script triggered twice

**URL:** <https://forum.inductiveautomation.com/t/upload-component-gets-file-received-script-triggered-twice/97653>\
**Category:** Ignition\
**Tags:** ignition81, python, scripting, perspective\
**Created:** [October 23, 2024, 9:18am UTC](https://forum.inductiveautomation.com/t/upload-component-gets-file-received-script-triggered-twice/97653 "2024-10-23T09:18:54Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [October 23, 2024, 4:01pm UTC](https://forum.inductiveautomation.com/t/upload-component-gets-file-received-script-triggered-twice/97653/4 "2024-10-23T16:01:28Z")

</div>

There was a bug where small files would trigger twice when uploaded.

> [@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.

I used this work around as I am not quite ready to update:

> [@\[IGN-8219\] Perspective File Upload onFileReceived being called twice](https://forum.inductiveautomation.com/t/ign-8219-perspective-file-upload-onfilereceived-being-called-twice/32472/5):
>
> 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) …

---

_[View the full topic](https://forum.inductiveautomation.com/t/upload-component-gets-file-received-script-triggered-twice/97653)._
