start manul upload only after validation passes?

4 posts, 0 answers
  1. moegal
    moegal avatar
    273 posts
    Member since:
    Jul 2007

    Posted 15 Apr 2013 Link to this post

    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
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 18 Apr 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. moegal
    moegal avatar
    273 posts
    Member since:
    Jul 2007

    Posted 18 Apr 2013 Link to this post

    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?
  5. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 23 Apr 2013 Link to this post

    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.
Back to Top