Re: FileTypeNotSupportMsg include Filename in the pattern

  •  10-18-2012, 7:50 AM

    Re: FileTypeNotSupportMsg include Filename in the pattern

    Hi KatlimRuiz,

     

    To achieve your requirement, I suggest you verify the file extension in API CuteWebUI_AjaxUploader_OnSelect and custom the verify logic there. like the example below, try to upload a file (not jpg), it should shows the error message format what you need.

     

    1. <%@ Page Language="C#" Title="Customize the queue UI" %>  
    2.   
    3. <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">  
    5.   
    6. <script runat="server">  
    7.     protected override void OnLoad(EventArgs e)  
    8.     {  
    9.          h1.Value = UploadAttachments1.ValidateOption.AllowedFileExtensions;  
    10.         base.OnLoad(e);  
    11.     }  
    12. </script>  
    13.   
    14. <html xmlns="http://www.w3.org/1999/xhtml">  
    15. <head id="Head1" runat="server">  
    16. </head>  
    17. <body>  
    18.     <form id="Form1" runat="server">  
    19.         <div>  
    20.             <CuteWebUI:UploadAttachments runat="server" ID="UploadAttachments1">  
    21.                 <ValidateOption AllowedFileExtensions="jpg" />  
    22.             </CuteWebUI:UploadAttachments>  
    23.             <asp:HiddenField ID="h1" runat="server" />  
    24.         </div>  
    25.     </form>  
    26. </body>  
    27. </html>  
    28.   
    29. <script>  
    30. var h1=document.getElementById("<%= h1.ClientID %>");  
    31.   
    32. function CuteWebUI_AjaxUploader_OnSelect(files)  
    33. {  
    34.   for(var i=0;i<files.length;i++)  
    35.   {  
    36.       if(files[i].FileName.substring(files[i].FileName.lastIndexOf(".")+1)!="jpg")  
    37.       {  
    38.         //h1.value is the AllowedFileExtensions string of uploader  
    39.         //files[i].FileName is the current upload file name  
    40.         alert("The file "+ files[i].FileName+ " is not supported. Only the following extensions "+ h1.value);  
    41.         return false;  
    42.       }  
    43.   }  
    44. }  
    45. </script>  
    Regards,

     

    Ken 

     

     

View Complete Thread