Re: Set Maximum File Limit

  •  04-09-2012, 4:11 AM

    Re: Set Maximum File Limit

    Hi,
     
    If you want to set the limitation by the input value, I suggest you try function "CuteWebUI_AjaxUploader_OnSelect", like the example below.
     
    MaxFilesLimit is the server side property, can not set by the javascript code.
    1. <?php require_once "phpuploader/include_phpuploader.php" ?>  
    2. <?php session_start(); ?>  
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
    4. <html xmlns="http://www.w3.org/1999/xhtml">  
    5. <head>  
    6.     <title>example</title>  
    7. </head>  
    8. <body>  
    9. <div>  
    10.   <input onkeyup="value=value.replace(/[^\d]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"  
    11.             id="no_of_spreads" >  
    12.   
    13.     <?php  
    14.         $uploader=new PhpUploader();  
    15.         $uploader->MultipleFilesUpload=true;  
    16.         $uploader->InsertText="Select multiple files (Max 10M)";  
    17.         $uploader->AllowedFileExtensions="*.jpg,*.png,*.gif,*.bmp";  
    18.         $uploader->Render();  
    19.     ?>  
    20.       
    21.     <script type='text/javascript'>  
    22.     var no_of_spreads= document.getElementById("no_of_spreads");  
    23.     function CuteWebUI_AjaxUploader_OnSelect(files)  
    24.     {  
    25.         if(no_of_spreads.value=="")  
    26.         {  
    27.             alert("The maximun number of files allowed to be uploaded is set to 0");  
    28.             return false;  
    29.         }  
    30.         if(files.length>no_of_spreads.value)  
    31.         {  
    32.             alert("The maximun number of files allowed to be uploaded is set to "+no_of_spreads.value);  
    33.             return false;  
    34.         }  
    35.     }  
    36.     </script>  
    37.     </div>  
    38. </body>  
    39.       
    40. </html>  
    Regards,
     
    Ken 
View Complete Thread