Upload component gets file Received Script triggered twice

I have perspective view where i am uploading
a excel file for that onfilereceived event i have script to parse the excel but the onfilereceived is getting triggered twice and sometime once it is getting triggered how do i restrict this from getting triggered twice.
Thanks for the help

Are you sure it's getting triggered twice?
I added a print statement to the onFileReceived event and it only fired once when I uploaded a file

system.perspective.print(event)

I ran into that issue myself a while back, and came up with this workaround:

def runAction(self, event):
	import java.lang.Exception
	from threading import Timer
	
	# Fixes a bug in Ignition that causes this event to fire twice in a row...
	def setOkayToUpload(self):
		self.custom.okayToUpload = True
	
	if self.custom.okayToUpload:
		self.custom.okayToUpload = False
		...(process upload)...
		Timer(0.5, setOkayToUpload, [self]).start()

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

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

1 Like

Thanks for the help i will also try to do the same