validation and cancelation

2 posts, 0 answers
  1. Wielyanto
    Wielyanto avatar
    2 posts
    Member since:
    Sep 2008

    Posted 21 Apr 2009 Link to this post

    Hi have anybody tried to validate the file that is being uploaded, and if it fails the validation, then we cancel the upload that is about to be going on?

    I am trying to make a program that validates the file we are trying to upload, then if it fails the validation, there will be a message box to prompt the user, whether they still want to continue to upload that particular files.

    I put the validation on UploadStarted, and it will call a web service to check the database, to make sure it fulfills the criteria

    so does anybody know any possible way to cancel the upload?

    Many thanks in advance

  2. Bobi
    Bobi avatar
    513 posts

    Posted 22 Apr 2009 Link to this post

    Hello Wielyanto,

    You can cancel the upload in this way:

    1.Subscribe to the UploadStarted event
    2.Add the following code:

    private void RadUpload1_UploadStarted(object sender, UploadStartedEventArgs e)
                if (e.SelectedFiles[0].Name == "book2.jpg")
                    (sender as RadUpload).CancelUpload();

    This example demonstrates how to cancel the upload with simple validation for a particular name.

    I hope this answers your question.

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top