Posts: 42
Threads: 8
Joined: Mar 2018
Reputation:
1
Hello,
How do I validate files before they are uploaded. i.e. if I want to only allow files that have the word 'banana' somewhere in the filename, how do I check that before all the files are uploaded?
If the validation fails, how do I then cancel the upload? If multiple files are selected, and only one fails validation, can I just abort the upload of that one file?
Posts: 42
Threads: 8
Joined: Mar 2018
Reputation:
1
Hi Daniel,
Thank for the help. But that is not exactly what I wanted. In the case above, you are setting FileRejected to True AFTER the file is uploaded. Why go through the bother of letting them upload a 100 Mb file if I know I am going to reject it. For example, if I know I only allow files with the word "apple" somewhere in the filename, I should be able to abort the file upload before it starts if the filename does not contain the word apple.
Posts: 42
Threads: 8
Joined: Mar 2018
Reputation:
1
Hello,
While that link shows a bunch of javascript, I am not clear how that ties into the events that you expose. I presume I have to do something in the OnAsyncSelectFile, I just dont know to
a) get the filename currently "selected". Is that in the EventParms
b) how to signal to abort that file
Posts: 42
Threads: 8
Joined: Mar 2018
Reputation:
1
03-19-2018, 08:44 PM
(This post was last modified: 03-19-2018, 08:44 PM by davenovo.)
Ok, so please, just tell me, if I use OnAsyncSelectFile, how do I abort the upload of the file if I decide to do so? I would expect the OnAsyncSelectFile to have a parameter FileName:string and
procedure OnAsyncSelectFile(const aFileName:string; var aAllowUpload:boolean)
However, since that is not there, can you tell me how I tell the component to stop uploading that file. Please answer the following two questions that I have been asking
a) get the filename current file that is triggering the OnAsyncSelectFile. Is that in the EventParms?
b) how to signal to abort the upload of that file