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

start manul upload only after validation passes?

3 Answers 67 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
moegal
Top achievements
Rank 1
moegal asked on 15 Apr 2013, 05:18 PM
I am currently using RadAsyncUpload with ManualUpload="true". I have  MultipleFileSelection="Disabled" but will allow multiple file inputs.

I am also using RadProgressArea.

Is there a way to check for invalid files before I fire startUpload(); ??
Or if not, can I stop the upload without removing all of the inputs? 

If I cancel, can I restart the upload without removing all of the inputs?

Thanks, Marty

3 Answers, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 18 Apr 2013, 04:33 PM
Hi Marty,

To limit the maximum allowed file inputs set MaxFileInputsCount property:
<telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" ManualUpload="true" MaxFileInputsCount="1"MultipleFileSelection="Disabled" TargetFolder="~/Uploads">
</telerik:RadAsyncUpload>

Regarding file validation you could browser this online demo which demonstrates the same functionality as you need.

Regards,
Hristo Valyavicharski
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
moegal
Top achievements
Rank 1
answered on 18 Apr 2013, 05:41 PM
Hristo,

not sure I follow.  The demo says:

"The sever-side FileUploaded event is fired separately for each and every uploaded file. Each file can be marked as a valid or invalid using the IsValid property of FileUploadedEventArgs. Valid files are automatically saved to the target folder."

Here is my problem.

I might select 3 separate files.  2 of them pass my validation, but the 3rd one does not.

I do not want the user to upload any of the files unless they all pass, also I don't want to remove the selected files that did pass validation. And ideally I want to show/ highlight the file that did fail validation.  It could be removed and placed in a separate list like the demo.

Keep in mind I am using manual upload button.

Can I validate each file when it is selected but before I start the manul upload?
0
Hristo Valyavicharski
Telerik team
answered on 23 Apr 2013, 04:14 PM
Hi Marty,

RadAsyncUpload will validate each of the selected files automatically. If some of them doesn't pass the validation you could handle OnClientValidationFailed event and display notification message with wrong file name. Additionally you could check if three files are selected. I''m attaching small sample demonstrating how to achieved this functionality.

Regards,
Hristo Valyavicharski
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
AsyncUpload
Asked by
moegal
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
moegal
Top achievements
Rank 1
Share this question
or