MaxFilesLimit javascript

Last post 04-17-2009, 3:18 AM by cutechat. 1 replies.
Sort Posts: Previous Next
  •  04-16-2009, 10:50 PM 51187

    MaxFilesLimit javascript

    Hi
     
    Is it possible to set the  MaxFilesLimit and  MaxFilesLimitMsg through javascript ?
  •  04-17-2009, 3:18 AM 51193 in reply to 51187

    Re: MaxFilesLimit javascript

    Hi,
     
    Currently not.
     
    But you can use the CuteWebUI_AjaxUploader_OnSelect event to do custom limitation.
     
    Please check this sample :
     
    1. <%@ Page Language="C#" Title="First sample" %>  
    2.   
    3. <%@ Import Namespace="CuteWebUI" %>  
    4. <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>  
    5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">  
    6.   
    7. <script runat="server">  
    8.     protected void Button1_Click(object sender, EventArgs e)   
    9.     {   
    10.   
    11.     }   
    12.   
    13.     void InsertMsg(string msg)   
    14.     {   
    15.         ListBoxEvents.Items.Insert(0, msg);   
    16.         ListBoxEvents.SelectedIndex = 0;   
    17.     }   
    18.     protected void UploadAttachments1_AttachmentAdded(object sender, AttachmentItemEventArgs args)   
    19.     {   
    20.         InsertMsg("Added.." + args.Item.FileName);   
    21.     }   
    22. </script>  
    23.   
    24. <html xmlns="http://www.w3.org/1999/xhtml">  
    25. <head id="Head1" runat="server">  
    26. </head>  
    27. <body>  
    28.     <form id="Form1" runat="server">  
    29.         <CuteWebUI:UploadAttachments runat="server" ID="UploadAttachments1" OnAttachmentAdded="UploadAttachments1_AttachmentAdded">  
    30.             <ItemCellStyle CssClass="Cell" />  
    31.             <TableStyle CssClass="Table" />  
    32.         </CuteWebUI:UploadAttachments>  
    33.         <br />  
    34.         <div>  
    35.             Server Trace:   
    36.             <br />  
    37.             <asp:ListBox runat="server" ID="ListBoxEvents" Width="800"></asp:ListBox>  
    38.         </div>  
    39.     </form>  
    40.   
    41.     <script type="text/javascript">  
    42.     function CuteWebUI_AjaxUploader_OnSelect(files)   
    43.     {   
    44.         var uploader=this;   
    45.         var qcount=uploader.getqueuecount();   
    46.         var scount=files.length;   
    47.         if(qcount+scount>10)   
    48.         {   
    49.             alert("You can only upload 10 files");   
    50.             return false;//cancel it.   
    51.         }   
    52.     }   
    53.     </script>  
    54.   
    55. </body>  
    56. </html>  
     
    Regards,
    Terry
     
View as RSS news feed in XML