[IGN-406] Perspective File Upload Component - Enabled

Does anyone know of a way to disable the perspective file upload component based on some type of expression? I have an instance where the user needs to enter a certain property before being allowed to upload a file. There doesn’t seem to be an “enabled” property for this component which I find unusual?

We have an open feature request to provide props.enabled as a property for the component. There is no way currently to disabled the component, though you are able to prevent any supplied files from being uploaded by constructing your own conditions in the onFileReceived Event.

Good to know. For now I just dropped it in a view component and bound the visibility. Not a perfect solution but it will work for now.

As of v8.1.17 I still don’t see an enabled property. Since I can’t find an idea post on Ignition Features and Ideas | Inductive Automation, please consider this a vote for this as a useful feature.

We’ll implement a workaround in a similar way, but it would be nice if we could handle the case where we’re not yet ready for an upload a bit more gracefully.

It's 2024 and that property is still not here, how do I prevent a user from uploading a file if a condition is not met?

I need them to make a comment in a text area and upload their file, but if there is no text, how do I make it so that the file isn't received/uploaded?

Consider hiding the upload component until the conditions are met.

2 Likes

hm... okay. :confused:

Developing in Perspective is a life lesson in choosing between unpleasant limitations or cracking one's skull with hacky work-arounds. When there is a choice, that is.

:frowning_face:

1 Like

This time it wasnt super hacky, thought its not 100% safe, be sure to block off the onfilerecieved event too if its critical
image

2 Likes

Yeah, just in case someone tabs into the upload entry field.

I like changing display to none. And making some dummy button visible in its place.

1 Like

removing tab index is also possible, but that would require some hacky workarounds xd

:grin: I rest my case.

1 Like

you could also set maxupload amount and size to 0 i guess, when tabbing the fileexplorer still opens but atleast they cant upload anything,
image

Or you can just display a label that actually explains "uploads forbidden without comment". :man_shrugging:

2 Likes

I second having the file component both hidden and replaced with a descriptive dummy.

If it's just missing, or unclickable, or can upload 0 files, users will ignore the context and treat it as a bug.