File Upload Perspective

Hi everyone,

I need some helps with the file upload component, even with the doc i don’t understand how it work.

I need this component for uploading a picture from my tablet to send it to some one else.

Somebody can explain me how this component work ?

Actualy I tried to use the " onFileReceived " event with event.file.copyto but I’m stuck.

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.

3 Likes

Thanks you a lot !

There is a component or a method which allow me to take a picture from my tablet camera (by the way is not an android tablet) ?

We do not currently have any way for Perspective to take a picture with a mobile device (outside of scanning a barcode, which does not actually save a file to your device). A “Picture” action is something we’re considering in later versions, but it’s not even in a planning stage yet.

Although, at least some browsers (mobile Safari in particular I know does this) allow you to directly take a picture when prompted to upload a file. It’s up to your device and browser whether to prompt for this, so it’s worth trying different browsers and looking into device settings.

Thanks, but i will look if with my windows 10 tablet i can have this.

Any updates/ plans to make this a feature in the app?

To make what a feature in the app?

@cmallonee
the folders/directories in webserver\webapps\main seems to be forbidden to acces in the browser (error 403) i can acces the images inside it, but i would also like to acces the whole folder itself
is there somewhere where i can allow it? (some htacces config or something?)

in the webserver/webdefault servlet file the dirAllowed is already true so not sure where else it could be

edit:
ah nvm i found it
webserver\webapps\main\WEB-INF\web here it stood on false