Maximum number of files to be uploaded

Last post 03-13-2009, 12:19 PM by cutechat. 5 replies.
Sort Posts: Previous Next
  •  03-10-2009, 2:10 PM 49697

    Maximum number of files to be uploaded

    Hello
    I am setting

    Uploader1.MultipleFilesUpload = False

     
    I am using manual upload,When i user selects a file using browse, If the user tries to upload a different file I get the maximum files to upload is 1. What I waould like to do is clearthe attachments from the uploader when the browse is clicked again.
    I tried to to cancelalltaks in
     CuteWebUI_AjaxUploader_OnBrowse()
     
    I also tried in the onprerender and init,

    If Uploader1.Items.Count > 0 Then

    Uploader1.DeleteAllAttachments()

    End If
     
    the error message seems to always be fired before.
    How can I allow a different file selction
     
    Thanks
  •  03-10-2009, 2:41 PM 49701 in reply to 49697

    Re: Maximum number of files to be uploaded

    Will the following example help?
     
    Uploading multiple files (Limit the maximum number of files to be uploaded)
    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.

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  03-11-2009, 6:29 AM 49733 in reply to 49701

    Re: Maximum number of files to be uploaded

    the example abobe is not what I am looking for. What I would like to tdo I  allow the user to upload one file only. so the user chooses browser pick the file , before manually uploading the user might want to upload a different file, so he should be able to click on browse again and select another file, but here is where i get a javascript alert saying maximum number of files to be uploaded is 1, I do not want this alert and what i would like to achieve f browse was clicked on again to reset the uploader and add the new file info.
    thanks
  •  03-11-2009, 6:52 AM 49735 in reply to 49697

    Re: Maximum number of files to be uploaded

    Hi,
     
    Are you using the last version ?
     
    The last version already would automatically replace the file if the MultipleFilesUpload set to flase
     
    Please check this sample:
     
     

     
     
    1. <%@ Page Language="C#" %>  
    2. <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>  
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    4. <html xmlns="http://www.w3.org/1999/xhtml">  
    5. <head runat="server">  
    6.     <title>Sample</title>  
    7. </head>  
    8. <body>  
    9.     <form id="form1" runat="server">  
    10.         <div>  
    11.             <CuteWebUI:UploadAttachments runat="server"    
    12. ID="Uploader1" ManualStartUpload="true" MultipleFilesUpload="false" />  
    13.             <hr />  
    14.             <asp:Button runat="server" ID="SubmitButton"    
    15. OnClientClick="return submitbutton_click()"  
    16.                 Text="Submit" />  
    17.         </div>  
    18.     </form>  
    19. </body>  
    20.   
    21. <script type="text/javascript">  
    22.     function submitbutton_click()   
    23.     {   
    24.         var submitbutton=document.getElementById('<%=SubmitButton.ClientID %>');   
    25.         var uploadobj=document.getElementById('<%=Uploader1.ClientID %>');   
    26.         if(!window.filesuploaded)   
    27.         {   
    28.             if(uploadobj.getqueuecount()>0)   
    29.             {   
    30.                 uploadobj.startupload();   
    31.             }   
    32.             else   
    33.             {   
    34.                 alert("Please browse files for upload");   
    35.             }   
    36.             return false;   
    37.         }   
    38.         window.filesuploaded=false;   
    39.         return true;   
    40.     }   
    41.     function CuteWebUI_AjaxUploader_OnPostback()   
    42.     {   
    43.         window.filesuploaded=true;   
    44.         var submitbutton=document.getElementById('<%=SubmitButton.ClientID %>');   
    45.         submitbutton.click();   
    46.         return false;   
    47.     }   
    48. </script>  
    49.   
    50. </html>  
    Regards,
    Terry
     
  •  03-12-2009, 6:57 AM 49791 in reply to 49735

    Re: Maximum number of files to be uploaded

    It turns out that it was because i Was doing this

    Uploader1.MaxFilesLimit = 1(that is what's causing the alert box to show up and preventing me from updating the file or clicking on browse again)

    Uploader1.MultipleFilesUpload = False
     
    Thanks
  •  03-13-2009, 12:19 PM 49845 in reply to 49791

    Re: Maximum number of files to be uploaded

    Oh, That is a small bug , when not use multiple feature , that property should be ignored.
     
    Please set it to larger. We will fix that bug later.
     
    Regards,
    Terry
View as RSS news feed in XML