File Upload Perspective

upload_path = 'webserver/webapps/main/'
system.util.getLogger('FILEUPLOAD').info('Uploading: \'{0}\' to directory \'{1}\''.format(event.file.name, upload_path))
event.file.copyTo(upload_path + event.file.name)

will place a file directly into the Inductive Automation\ignition\webserver\webapps\main directory of your Gateway.

Assuming you upload a file to that destination, you can then locate that file (in the same script) with

system.file.fileExists(upload_path + event.file.name)

If you were to upload an image with a file name of “filename.jpeg”, for example, then you would then point to that file in an Image component with /filename.jpeg.

5 Likes