File Validation

Thread is closed for posting
2 posts, 1 answers
  1. Berkman
    Berkman avatar
    23 posts
    Member since:
    Feb 2013

    Posted 04 Apr 2013 Link to this post

    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.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Apr 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top