FileTypeNotSupportMsg include Filename in the pattern

Last post 10-18-2012, 9:50 AM by KatlimRuiz. 2 replies.
Sort Posts: Previous Next
  •  10-17-2012, 4:24 PM 75005

    FileTypeNotSupportMsg include Filename in the pattern

    Hi

     

    Can we add a new enhancement to the control so the Filename is a wildcard in the message that we can insert?

     

    Today the message says something like "Only these file extensions are possible {0}" where {0} is the file extension list (.bmp, .xls).

     

    The assumption should be "The file {0} is not supported. Only the following extensions {1}".

     

    Or is there a way to do this today? Maybe I need to upgrade the component?

     

    Im using version AjaxUploader 3.0 20111024

     

    Thanks

  •  10-18-2012, 7:50 AM 75015 in reply to 75005

    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 

     

     

  •  10-18-2012, 9:50 AM 75020 in reply to 75015

    Re: FileTypeNotSupportMsg include Filename in the pattern

    Thanks for the answer.

     

    However, I wouldnt like to do that whole code just for the sake of showing the filename. The system I work in is multi language, and has some quirks I dont want to mess with.

    I just prefer to keep it as simple as possible and as it comes from stock.

     

    We can live without it for now, but I think it should be a nice feature to have.

     

    Thanks

View as RSS news feed in XML