Re: Start uploading manually more than 1 files

  •  10-26-2012, 7:28 AM

    Re: Start uploading manually more than 1 files

    Hi AlxReiter,

     

    Please try the example below, it will work for both uploader controls.

     

    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. <script runat="server">  
    6.   
    7.   
    8.     protected override void OnInit(EventArgs e)  
    9.     {  
    10.         base.OnInit(e);  
    11.         SubmitButton.Attributes["onclick"] = "return submitbutton_click()";  
    12.     }  
    13.   
    14. </script>  
    15. <html xmlns="http://www.w3.org/1999/xhtml">  
    16. <head id="Head1" runat="server">  
    17.     <title>Start uploading manually</title>  
    18. </head>  
    19. <body>  
    20.     <form id="form1" runat="server">  
    21.     <div class="content">  
    22.         <CuteWebUI:UploadAttachments runat="server" ManualStartUpload="true" ID="Uploader1"  
    23.             InsertText="Browse Files1 (Max 1M)">  
    24.         </CuteWebUI:UploadAttachments>  
    25.         <br />  
    26.         <CuteWebUI:UploadAttachments runat="server" ManualStartUpload="true" ID="Uploader2"  
    27.             InsertText="Browse Files2 (Max 1M)">  
    28.         </CuteWebUI:UploadAttachments>  
    29.         <p>  
    30.             <asp:Button runat="server" ID="SubmitButton" Text="Submit" />  
    31.         </p>  
    32.         <script type="text/javascript">  
    33.   
    34.             function submitbutton_click() {  
    35.                 var submitbutton = document.getElementById('<%=SubmitButton.ClientID %>');  
    36.                 var uploadobj = document.getElementById('<%=Uploader1.ClientID %>');  
    37.                 var uploadobj2 = document.getElementById('<%=Uploader2.ClientID %>');  
    38.                 if (!window.filesuploaded) {  
    39.                     if (uploadobj.getqueuecount() > 0 && uploadobj2.getqueuecount() > 0) {  
    40.   
    41.                         uploadobj.startupload();  
    42.                         uploadobj2.startupload();  
    43.                     }  
    44.                     return false;  
    45.                 }  
    46.                 window.filesuploaded = false;  
    47.                 return true;  
    48.             }  
    49.             function CuteWebUI_AjaxUploader_OnPostback() {  
    50.                 window.filesuploaded = true;  
    51.                 var submitbutton = document.getElementById('<%=SubmitButton.ClientID %>');  
    52.                 submitbutton.click();  
    53.                 return false;  
    54.             }  
    55.         </script>  
    56.     </div>  
    57.     </form>  
    58. </body>  
    59. </html>  
     

    Regards,

     

    Ken 

View Complete Thread