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

validation and cancelation

1 Answer 80 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.
Wielyanto
Top achievements
Rank 1
Wielyanto asked on 21 Apr 2009, 05:04 PM
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.

FYI
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


1 Answer, 1 is accepted

Sort by
0
Bobi
Telerik team
answered on 22 Apr 2009, 10:14 AM
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();
                return;
            }
.....
}

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

I hope this answers your question.

Sincerely yours,
Boryana
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.
Tags
Upload
Asked by
Wielyanto
Top achievements
Rank 1
Answers by
Bobi
Telerik team
Share this question
or