Re: The uploader freezes IE7 when 500 files are selected.

  •  11-06-2008, 6:46 AM

    Re: The uploader freezes IE7 when 500 files are selected.

    Hi,
     
    To select multiple files in a same directory , the browser requires the Flash/Silverlight .
     
    Please try this sample:
     
     

    <%@ Page Language="C#" Title="Uploading multiple files like GMail" %>

    <script runat="server">
      
     void InsertMsg(string msg)
     {
      ListBoxEvents.Items.Insert(0, msg);
      ListBoxEvents.SelectedIndex = 0;
     }

     void Uploader_FileUploaded(object sender, UploaderEventArgs args)
     {
      InsertMsg("Uploaded file : " + args.FileName + " - " + args.FileSize);
     }

    </script>

    <html>
    <head runat="server">
    </head>
    <body>
     <form runat="server">
      <h2>
       Uploading multiple files (Limit the maximum allowed number of files to be uploaded)</h2>
      <p>
       This example shows you how to limit the maximum allowed number of files to be uploaded.
       In the following example, you can only upload 3 files.</p>
      <br />
      <CuteWebUI:Uploader runat="server" ID="Uploader1" InsertText="Upload Multiple files Now"
       MultipleFilesUpload="true" OnFileUploaded="Uploader_FileUploaded">
      </CuteWebUI:Uploader>
      <div id="myqueueui" style="display: none">
      </div>
      <br />
      <br />
      <div>
       Server Trace:
       <br />
       <asp:ListBox runat="server" ID="ListBoxEvents" Width="400"></asp:ListBox>
      </div>

      <script type="text/javascript">
     function CuteWebUI_AjaxUploader_OnQueueUI(list)
     {
      var myqueueui=document.getElementById("myqueueui");

      if(list.length<10)
      {
       myqueueui.style.display="none";
       //use default UI
       return true;
      }
      
      var standby=0;
      
      for(var i=0;i<list.length;i++)
      {
       var name=list[i ].FileName
       var size=list[i ].FileSize // (or -1)
       var stat=list[i ].Status // Finish|Error|Upload|Queue
       var func=list[i ].Cancel;
       
       if(stat=="Queue")
        standby++;
      }

      myqueueui.innerHTML= "Uploading.. "+(list.length-standby)+"/"+list.length+ " files.";
      myqueueui.style.display="";
      
      //hide the default UI
      return false;
     }
     function CuteWebUI_AjaxUploader_OnProgress(enable,filename,starttime,sentsize,totalsize)
     {
      //var myqueueui=document.getElementById("myqueueui");
      
      //if use the default queue UI , then use the default progress bar too.
      //if(myqueueui.style.display=="none")
      // return true;
       
      //hide the default progress bar.
      //return false;
     }
      </script>

     </form>
    </body>
    </html>

     
    Regards,
    Terry
View Complete Thread