Reset file upload component in perspective

I am using File upload component to upload image. There is condition, if image is 16:9 ratio then only image will upload. I am calculating aspect ratio of image on File received event.
If uploaded image is not in 16:9 ratio , I am showing one error message, But file upload component is showing message like image uploaded successfully.
I dont want that message if image is not in given ratio. How can I do this?


You can’t interrupt the file upload process. Once the event has fired, you’re executing code on the gateway, and from the front end’s perspective, the file has uploaded successfully.

I believe there’s an existing ticket to allow you to manually ‘reset’ the file upload component mentioned here on the forums, but there’s just not really any way to process and reject the image before it’s been fully uploaded - all Perspective scripting is happening on the gateway.

Also, technically speaking, the upload IS successful - it’s what you do after the upload completes which is failing specified checks. What I do in these situations is I place an Icon next to the File Upload to signify whether all checks were made, and sometimes I’ll place an accompanying Label to which I could print any “error” messages which occurred during the process. For the Icon, I will usually default it to an “indeterminate” state when the upload process begins (onFileReceived), and then as the last line of code I set the state to a “positive” state. In the event a file fails my own requirements I set the state to “negative”. If handling multiple files, you’ll need to provide some state retention between files.