Re: How to set the file names in FileTooLargeMsg property?

  •  02-05-2013, 1:08 PM

    Re: How to set the file names in FileTooLargeMsg property?

    Hi mvjr,

     

    The catch error function will check the file one by one, so it will not get all the large files at the same time. you can catch all upload file size when the user selec the files for upload, then check it by your own code, like below.

     

     

    1. <%@ Page Language="C#" %>  
    2.   
    3. <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>  
    4. <!DOCTYPE html>  
    5.   
    6.   
    7. <html xmlns="http://www.w3.org/1999/xhtml">  
    8. <head runat="server">  
    9.     <title></title>  
    10. </head>  
    11. <body>  
    12.     <form id="form1" runat="server">  
    13.                      <CuteWebUI:UploadAttachments runat="server" ID="uploader1">  
    14.                          </CuteWebUI:UploadAttachments>  
    15.     </form>  
    16. </body>  
    17. </html>  
    18. <script type="text/javascript">  
    19.     function CuteWebUI_AjaxUploader_OnSelect(files) {  
    20.         var namelist = "";  
    21.         var sizelist = "";  
    22.         for (var i = 0; i < files.length; i++)  
    23.         {  
    24.             var size = files[i].FileSize / 1024;//kb  
    25.             //max is 10kb  
    26.             if (size > 10)  
    27.             {  
    28.                 namelist+=files[i].FileName;  
    29.                 namelist += ",";  
    30.                 sizelist += size;  
    31.                 sizelist += ",";  
    32.             }  
    33.            
    34.         }  
    35.         if (namelist != "")  
    36.         {  
    37.             alert(namelist + "cannot be uploaded. File size(" + sizelist + ") is too large");  
    38.             return false;  
    39.         }  
    40.         
    41.     }  
    42. </script>  

    Regards,

     

    Ken 

View Complete Thread