Re: Manual upload with visible="false"

  •  11-15-2012, 2:01 PM

    Re: Manual upload with visible="false"

    Hi,

     

    You need to check the uploader instance is available before you use "startupload()". Try the example below

    I just added the section below for your code.

     

    if (uploadobj) {}

    1. <%@ Page Language="C#" AutoEventWireup="true" %> 
    2.  
    3. <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %> 
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
    5. <html xmlns="http://www.w3.org/1999/xhtml"
    6. <head id="Head1" runat="server"
    7.     <title>Start uploading manually</title> 
    8.     <script type="text/javascript"
    9.  
    10.         function submitbutton_click() { 
    11.  
    12.             var submitbutton = document.getElementById('<%=SubmitButton.ClientID %>'); 
    13.  
    14.             var fileInputs = ["<%=fileinput1.ClientID%>"
    15.                               "<%=fileinput2.ClientID%>"
    16.                               "<%=fileinput3.ClientID%>"]; 
    17.  
    18.             if (!window.filesuploaded) { 
    19.                 for (var i = 0; i < 3; i++) { 
    20.  
    21.                     var uploadobj = document.getElementById(fileInputs[i]); 
    22.                     if (uploadobj) { 
    23.                         if (uploadobj.getqueuecount() > 0) { 
    24.                             uploadobj.startupload(); 
    25.                         } 
    26.                     } 
    27.  
    28.                 } 
    29.                 return false
    30.             } 
    31.  
    32.             window.filesuploaded = false
    33.             return true
    34.         }  
    35.           
    36.     </script> 
    37. </head> 
    38. <body> 
    39.     <form id="form1" runat="server"
    40.     <table border="0" cellpadding="0" cellspacing="0" width="100%"
    41.         <tr valign="middle"
    42.             <td class='standardText'
    43.                 <asp:Label Visible="true" ID="label1" runat="server">First file for upload</asp:Label> 
    44.             </td> 
    45.             <td class='standardText'
    46.                 <CuteWebUI:Uploader runat="server" ManualStartUpload="true" ID="fileinput1" InsertText="Browse Files1" 
    47.                     MultipleFilesUpload="true" Visible="False"
    48.                 </CuteWebUI:Uploader> 
    49.             </td> 
    50.         </tr> 
    51.         <tr valign="middle"
    52.             <td class='standardText'
    53.                 <asp:Label Visible="true" ID="label2" runat="server">Second file for upload</asp:Label> 
    54.             </td> 
    55.             <td class='standardText'
    56.                 <CuteWebUI:Uploader runat="server" ManualStartUpload="true" ID="fileinput2" InsertText="Browse Files2" 
    57.                     MultipleFilesUpload="true" Visible="True"
    58.                 </CuteWebUI:Uploader> 
    59.             </td> 
    60.         </tr> 
    61.         <tr valign="middle"
    62.             <td class='standardText'
    63.                 <asp:Label Visible="true" ID="label3" runat="server">Last file for upload</asp:Label> 
    64.             </td> 
    65.             <td class='standardText'
    66.                 <CuteWebUI:Uploader runat="server" ManualStartUpload="true" ID="fileinput3" InsertText="Browse Files3" 
    67.                     MultipleFilesUpload="true" ValidateOption-MaxSizeKB="2097152" Visible="True"
    68.                 </CuteWebUI:Uploader> 
    69.             </td> 
    70.         </tr> 
    71.         <caption> 
    72.             <p> 
    73.                 <asp:Button ID="SubmitButton" runat="server" Text="Submit" OnClientClick="return submitbutton_click()" /> 
    74.             </p> 
    75.         </caption> 
    76.     </table> 
    77.     </form> 
    78. </body> 
    79. </html> 

     

    Regards,

     

    Ken

     

View Complete Thread