This is a migrated thread and some comments may be shown as answers.

[Solved] Cancelling 'onUpload' client event removes file

1 Answer 24 Views
Upload
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jon
Top achievements
Rank 1
Jon asked on 18 Oct 2011, 10:47 AM
Hi.

I'm using the onUpload client event to perform some validation of other controls that I use to provide metadata to be sent to the server (i.e. a file description).  If the validation fails, I display a suitable message to the user, and call e.preventDefault().

However, when I do this the selected file is removed from the queue.  This is not an action that I want to happen, as it forces the user to re-select the file, even though it was not the cause of the validation failure.

Is there some way to prevent this default behaviour?  (I've amended the performUpload function in 'telerik.upload.js' for now, but I obviously don't want to amend the core code in the long run.)

Thanks,

Jon Knight

(Excellent controls, by the way!)

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 21 Oct 2011, 08:19 AM
Hi Jon,

I agree that removing the file when the Upload event is cancelled is not valid in every scenario. We'll consider our options for giving the developer more control.

Our suggestion is to disable the "Upload selected" button until all inputs are filled in. Changing the source is valid as well, but you should keep an eye on the change log for any important modifications in the Upload.

Greetings,
Tsvetomir Tsonev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Upload
Asked by
Jon
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or