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

RadUpload Non Allowable File List

4 Answers 114 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Tin
Top achievements
Rank 1
Tin asked on 24 May 2012, 06:16 AM
Hello Everyone !

How can I set the non allowable file list in RadUpload. I will like to set up the blacklist file type and  except of these blacklist I will allow to upload file .

How can I do these in radupload control ? I need your help Urgently .

Thanks ,
Tin

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 May 2012, 07:22 AM
Hi Tin,

I suppose that you want to allow only some file extensions for uploaded files. The AllowedFileExtensions property lists the valid file extensions for uploaded files. When the AllowedFileExtensions property is set, RadUpload automatically validates the extensions of selected files, moving any files with disallowed extensions to the InvalidFiles collection.

ASPX:
<telerik:RadUpload id="RadUpload1" runat="server" allowedfileextensions=".zip,.jpg,.jpeg" />

Hope this helps.

Thanks,
Princy.
0
Tin
Top achievements
Rank 1
answered on 24 May 2012, 07:29 AM
Hello Princy

Thanks for your reply .I already used what did you mention. However now I can't give the allowable  file list . I want to give only invalid file list . So What can I do is use CustomValidator is it correct way ?Any the best solution ? Let me know ?

With BR,
Tin
0
Princy
Top achievements
Rank 2
answered on 24 May 2012, 10:30 AM
Hi Tin,

Try the following code snippet.

ASPX:
<telerik:RadUpload ID="RadUpload1" runat="server" onvalidatingfile="RadUpload1_ValidatingFile"  >
</telerik:RadUpload>

C#:
protected void RadUpload1_ValidatingFile(object sender, Telerik.Web.UI.Upload.ValidateFileEventArgs e)
    {
        UploadedFile file = e.UploadedFile;
        if( file.GetExtension() ==".gif")//can give the invalid file extensions
           {
               Response.Write("Invalid file");
               e.IsValid = false;
           }
    }

Hope this helps.

Thanks,
Princy.
0
Tin
Top achievements
Rank 1
answered on 24 May 2012, 12:09 PM
Hello Princy ,

Thanks you so much for you help. It is help me .

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