Re: Limit total size of attachments

  •  01-31-2011, 3:04 PM

    Re: Limit total size of attachments

    Dear SergeyC,
     
    Client validation:
    <script type="text/javascript">
    function CuteWebUI_AjaxUploader_OnSelect(files) {
                var selectedSize = 0;
                for (var i = 0; i < files.length; i++) {
                    selectedSize += files[i].FileSize;
                }
                //if selected files size is greater than this value, will stop the upload
                if (selectedSize > 1024 * 1024 * 1024) {
                       alert("the selected file size is "+ FormatSize(selectedSize)+",you only can upload 1G files");
                       return false;
                }
            }
    </script>
     
    Server side validation:
         void Uploader_FileUploaded(object sender, UploaderEventArgs args)
        {
              //validate the total size of uploaded files or validate the used space of destination folder    
        }   
     
    Thank you for asking
View Complete Thread