Re: Upload start automatically after selecting an invalid file (e.g. larger than limit) even upload mode is set to manual

  •  05-04-2010, 11:21 AM

    Re: Upload start automatically after selecting an invalid file (e.g. larger than limit) even upload mode is set to manual

    Hello and thanks for your reply.
     
    Maybe I didn't make myself clear. Actually by an invalid file I meant an unacceptable file (a file with extension other than those defined in ValidateOption tag or bigger than MaxSizeKB).
     
    Here is the [trimmed version of] code. To simulate my problem add a file,  and then add another file (larger than 512Kb). It will show the error message but will immediately start uploading the files (even though the ManualStart is set to True) (config: IIS7/Win7/IE8)
     
    1. <cutewebui:UploadAttachments runat="server" ID="Attachments1" InsertButtonID="btnAdd"  
    2.     HideNoItemTable="true" AutoUseSystemTempFolder="False" ManualStartUpload="True"  
    3.     TempDirectory="templocation" ShowProgressBar="false"  >  
    4.     <ValidateOption AllowedFileExtensions="*.jpg, *.gif, *.png, *.bmp" MaxSizeKB="512" />  
    5. </cutewebui:UploadAttachments>  
    6. <div class="uploader" style="width: 700px;">  
    7.     <div id="filequeue_div" class="filequeue" style="visibility: collapse;">  
    8.     </div>  
    9.     <input type="button" id="btnAdd" onclick="return CancelAllTasks();" value="Add File(s)"/>  
    10.     <input type="button" id="btnUpload" onclick="return StartUpload()" value="Upload Files" />  
    11.     <input type="button" id="btnCancel" onclick="return CancelAllTasks();" value="Cancel Upload" />  
    12. </div>  
    13.   
    14. <script language="javascript" type="text/javascript">  
    15.   
    16.     var uploader = document.getElementById('<%= Attachments1.ClientID %>');  
    17.     uploader.handlequeueui = QueueUIHandler;  
    18.     var btnAdd = 'btnAdd';  
    19.     var btnUpload = 'btnUpload';  
    20.     var btnCancel = 'btnCancel';  
    21.   
    22.     function QueueUIHandler(list) {  
    23.   
    24.         if (list.length < 1) {  
    25.             var container = document.getElementById('filequeue_div');  
    26.             container.innerHTML = '';  
    27.             container.style.visibility = 'collapse';  
    28.         }  
    29.         else {  
    30.             var container = document.getElementById('filequeue_div');  
    31.             container.style.visibility = 'visible';  
    32.             var table = document.getElementById('uplistable');  
    33.   
    34.             if (table == null) {  
    35.                 container.innerHTML = '';  
    36.   
    37.                 table = document.createElement('table');  
    38.                 table.id = 'uplistable';  
    39.                 tablehead = document.createElement('thead');  
    40.                 var row = tablehead.insertRow(-1);  
    41.                 row.insertCell(-1).innerHTML = 'Filename';  
    42.                 table.appendChild(tablehead)  
    43.                 tablebody = document.createElement('tbody');  
    44.   
    45.                 for (var i = 0; i < list.length; i++) {  
    46.                     var name = list[i].FileName  
    47.                     var row = tablebody.insertRow(-1);  
    48.                     row.insertCell(-1).innerHTML = name;  
    49.                 }  
    50.                 table.appendChild(tablebody);  
    51.   
    52.                 container.appendChild(table);  
    53.             }  
    54.         }  
    55.         return false//hide the default;  
    56.     }  
    57.   
    58.     function CuteWebUI_AjaxUploader_OnPostback() {  
    59.         return false;  
    60.     }  
    61.   
    62.     function CuteWebUI_AjaxUploader_OnStart() {  
    63.         alert('started');  
    64.         //return false;  
    65.     }  
    66. </script> 
     
View Complete Thread