RadUpload Non Allowable File List

Thread is closed for posting
5 posts, 0 answers
  1. Tin
    Tin avatar
    9 posts
    Member since:
    Jan 2012

    Posted 24 May 2012 Link to this post

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

    Posted 24 May 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tin
    Tin avatar
    9 posts
    Member since:
    Jan 2012

    Posted 24 May 2012 Link to this post

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

    Posted 24 May 2012 Link to this post

    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.
  6. Tin
    Tin avatar
    9 posts
    Member since:
    Jan 2012

    Posted 24 May 2012 Link to this post

    Hello Princy ,

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

    Best Regards,
    Tin.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017