Does the upload widgets "clientAllowedFormats" fire any kind of event when it restricts an upload?

Nathan_CH
Nathan_CH Member Posts: 2
edited July 2023 in Developer APIs

Hello,

I have a use-case where I need to dynamically restrict the upload-format of the Upload widget on the client side, depending on the format of another file.

I've got that part down, I now need to notify the user of why an upload was restricted at all (i.e. that the two file formats don't match). For that I would first need to know when an upload was restricted by the upload widget in the first place.

Hope this question was clear enough, I tried digging through the docs aswell as here in the community, but I wasn't able to find an answer.

Thanks in advance, and have a good day!

Tagged:

Answers

  • victor_cloudinary
    victor_cloudinary Member, Cloudinary Staff Posts: 9

    Hi Nathan,

    Thanks for reaching out to us. I'm not quite clear on the details of dynamically restricting the upload format depending on the format of another file, but if you've got that sorted, that's good.

    There are "events" that can be used to trigger callbacks and error handling, which you can read about here: https://cloudinary.com/documentation/upload_widget#api_events

    Please note the bottom of that section that includes a link to a full list of events you can work with, as well as the section below that on "pre-batch validation" in case that is helpful for your use cases.

    If you have any questions about how to make this work for your purposes, please feel free to clarify your workflow and what you are trying to accomplish, and the issue you are encountering, and we'd be happy to help.

    Regards,

    Victor

  • Nathan_CH
    Nathan_CH Member Posts: 2

    Hello Victor,

    Thank you for your quick response!

    The pre-batch validation sadly wasn't useful in my case, as it doesn't (and probably can't) return the file type of the attempted uploaded file. Even so, your answer ended up pointing me in the right direction for another process that I am working on, so thanks for that.

    I knew about the events, I even ended up using a work-around with the 'upload-added' event that does contain information about the file type of the attempted uploaded file.

    Sorry for the tardy response, thanks again, and have a good day!