how to set total Upload file size limit.

  •  08-24-2011, 12:42 AM

    how to set total Upload file size limit.

    Hello,
     
    I want to upload multiple files but SUM of selected file's size is not greater then 100MB.
     
    I found below Solution but it was not achieve my requirement.
     
     function CuteWebUI_AjaxUploader_OnSelect(files) {
                    var uploader = document.getElementById('<%=Uploader1.ClientID %>');
                    var selectedSize = 0;
                    for (var i = 0; i < files.length; i++) {
                        selectedSize += files[i].FileSize;
                        
                    }
                    if (selectedSize > 104857600) {
                        alert("you only can upload 100MB files.");
                        return false;
                    }
                } 
     
    Issue in Above code :
    First  i select 5 files and each file size is 10MB so totalSize : 50MB
    then again i select 7 files and each file size is  10MB so totalsize of selected files is 70MB and it allowed to me upload.
     
    But Total file size : 50 + 70 = 120MB ....and my TotalSizeLimit is 100MB.....Issue is here.
     
    Problem : it is not checked the file size of previosly selected files.
     
    How can i solve this thing?
     
    Thanks in advance.
View Complete Thread