Re: How to validate files while uploading?

  •  01-18-2013, 5:17 PM

    Re: How to validate files while uploading?

    Hi mvjr,

     

    Please try the example below.

     

    1. <%@ Page Language="C#" %>  
    2.   
    3. <%@ Register Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" TagPrefix="CuteWebUI" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    5.   
    6. <script runat="server">  
    7.     protected void Uploader1_FileUploaded(object sender, UploaderEventArgs args)  
    8.     {  
    9.      if (args.FileName == "abc.jpg")  
    10.         {  
    11.             lb_error.Text = "upload error!";  
    12.             args.Delete();  
    13.         }  
    14.     }  
    15. </script>  
    16.   
    17. <html xmlns="http://www.w3.org/1999/xhtml">  
    18. <head id="Head1" runat="server">  
    19.     <title>example</title>  
    20. </head>  
    21. <body>  
    22.     <form id="form1" runat="server">  
    23.         <CuteWebUI:Uploader runat="server" ID="Uploader1"  OnFileUploaded="Uploader1_FileUploaded">  
    24.         </CuteWebUI:Uploader>  
    25.         <asp:Label ID="lb_error" runat="server"></asp:Label>  
    26.     </form>  
    27. </body>  
    28. </html>  
     

    Regards,

     

    Ken 

View Complete Thread