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

File Validation

1 Answer 42 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Berkman
Top achievements
Rank 1
Berkman asked on 04 Apr 2013, 08:26 AM
Hi,

While the user upload files to the server using RadUpload, Is there any mechanism to perform file validation process for a particular file extension alone?

Thankyou,
Berk.

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 04 Apr 2013, 10:15 AM
Hi Berkman,

It is possible to perform custom validation for a particular file extension. You can write the necessary code to perform custom validation in the ValidatingFile server-side event. Please have a look into the following C# code which performs a custom validation for ZIP files.

C#:
private void RadUpload1_ValidatingFile(object sender, ValidateFileEventArgs e)
{
    // check only the zip files 
    if (e.UploadedFile.GetExtension().ToLower() == ".zip")
    {
        //Your Custom Validation Code 
        
        // zip files must not be validated for file size by the internal validator   
        e.SkipInternalValidation = true;
    }
}

Thanks,
Princy.
Tags
Upload (Obsolete)
Asked by
Berkman
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or