Re: Setting max files

  •  01-13-2012, 2:29 PM

    Re: Setting max files

    Hi fchristensen,
     
    Please try the example below, it shows you how to limit the upload files to 5.
     
    <?php require_once "phpuploader/include_phpuploader.php" ?>
    <?php session_start(); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>example</title>
    </head>
    <body>
    <div>
    <?php
       $uploader=new PhpUploader();
       $uploader->Name="myuploader";
       $uploader->MultipleFilesUpload=true;
       $uploader->InsertText="Upload File (Max 10M)";   
       $uploader->MaxSizeKB=1024000; 
       $uploader->AllowedFileExtensions="jpeg,jpg,gif,png,zip";   
       $uploader->MaxFilesLimit=5;
       $uploader->Render();
      
      ?> 
    </div>
    <script>
    var count = 0;
    function CuteWebUI_AjaxUploader_OnQueueUI(list) {
       count = list.length;
    }
    function CuteWebUI_AjaxUploader_OnSelect(files)
    {
       var temp;
       temp = count;
       count = count + files.length;
       if (count > 5) {
           alert("only allow to upload 5 files!");
           count = temp;
           return false;
       }
    }
    </script>
    </body>
    </html>
     
    Regards,
     
    Ken 
View Complete Thread