Using Web Dev module or Perspective to create an internal file upload portal

I need to allow users to upload a file (a pdf, or possibly a Microsoft Word document) to a central file repository through Ignition. The reason we would like to do this "through" Ignition is to keep track of the quantity and status (and any other details) of these files, apply metrics, and so on.

Not sure how to get started though. Is a Perspective application the way forward, or mounting something using the Web Dev module, or something else? Even just a brief description of what steps you might take and what variables should be considered should help me greatly. I'm imagining creating a simple folder in our shared drive (which Ignition has access to) where these files would get dropped into, with a defined naming convention to help keep track of everything. Where I get stuck is figuring out how to allow users to put files in here using an Ignition-based resource that will run a database insertion at each upload.

Have you looked at the perspective file upload component?

You can restrict the size, file type and number of files and then save the file to any location the gateway services has access to in the onFileReceived event. You can also do your database insert on the same event.

If you want to use a network drive i would make sure the account that the ignition service runs has permission and use the UNC path.

3 Likes

I didn't know about that... I guess that answers my question :joy:

Thank you! I'll try it out and post back here if I hit any roadblocks...

The key to the whole thing isn't so much the upload task, but how you then want to control retrieval. If you need to expose direct URLs controlled by Ignition to the previously-uploaded files, you need either the WebDev module (a general solution) or my Blob Server module (if the content is stored as blobs in a database). If, instead, you are happy to let external servers (file, web, whatever) provide that access, nothing further is needed in Ignition. Finally, you can always use system.perspective.download() in a button script to expose the files via Perspective button actions.

4 Likes

Hi Phil,
Speaking of retrieval.
Can I retrieve blob file on database with a URL, similar to what blobserve module provides, without using your blobserve module?

Can we do this using web dev? If yes, does that mean blob data will have to be moved first in web dev mounted storage, then determine its UNC path, every time user access this blob?

The reason I ask is, I really like the convenience (and less dependency) that your module provides (skip the inconvenience of webdev), but for some strict (future) clients, I like to avoid explaining stake holder why we need a third party module.

@Eugene49 maybe through this? Altho also isnt without issues (on windows)

1 Like

Yes, you can have a jython WebDev resource prepare and run a NQ just like my blob server does.

I am totally unsympathetic. Third party modules are a necessity for Perspective development, IMNSHO, particularly for performant charting (Apex, Embr) and data manipulation (my Integration Toolkit). Avoiding these does your clients a disservice.

3 Likes

And just because a module is “free” doesn’t mean the support has to be free or best-effort only.

Money can be exchanged for goods and services.

1 Like

First I want to thank you. Web Dev been haunting me for so long - how to make it work. Above comment kept circling on my mind. At the end of the day, I laughed. "is this it? ... and it really is" - its about, end point, its about mounting a resource (python, folder, etc) at the end point, its a retrieval.

They should just renamed "mounted folder" to folder. This gave me major confusion, when manual says, you can mount a Python resource.

Question:
Why do we need to mount a folder, if gateway have access to its file system, and read the bytes, then respond the bytes?

And why does, designer on client side, when mounting a folder will open the clients file system (probably mounting to a common shared drive)?

I'm still laughing (in a good way). After all this time, it just this.

Because letting java do this natively is far more performant than spinning up some jython for every request. If all you want to do is serve files from a folder through web URLs.

No, "mounting" doesn't happen on the client side at all. The designer's script console is Vision Client scope, and its JVM naturally accesses files in that scope.