I'm facing a problem how to do properly custom validation of selected files before they are queued/uploaded. For example we need to ensure only valid file types of custom sizes are uploaded (with FileReaded API, there might be other interesting validation options).
Setting Uploader.fileTypes is not enough.
I'm considering FileQueuedHandler however at the time of its execution the file is already queued. I could call Uploader.cancelUpload in the handler but there's a small problem that FileDialogCompleteHandler's FileDialogCompleteEvent would not be consistent in terms of filesQueued reported.
Another option would be to do the validation in FileDialogCompleteHandler however the event doesn't carry files, only number of them and the files are not exposed.
What would be a recommended way of doing this?
I'm thinking that maybe adding a new OnBeforeFileQueuedEvent would be best. If the handler returned false, the file would be ignored.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm facing a problem how to do properly custom validation of selected files before they are queued/uploaded. For example we need to ensure only valid file types of custom sizes are uploaded (with FileReaded API, there might be other interesting validation options).
Setting Uploader.fileTypes is not enough.
I'm considering FileQueuedHandler however at the time of its execution the file is already queued. I could call Uploader.cancelUpload in the handler but there's a small problem that FileDialogCompleteHandler's FileDialogCompleteEvent would not be consistent in terms of filesQueued reported.
Another option would be to do the validation in FileDialogCompleteHandler however the event doesn't carry files, only number of them and the files are not exposed.
What would be a recommended way of doing this?
I'm thinking that maybe adding a new OnBeforeFileQueuedEvent would be best. If the handler returned false, the file would be ignored.