Support forums
in

Can it do mimimum file size validation?

Last post 08-19-2013, 1:13 PM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  08-19-2013, 2:03 AM 77860

    Can it do mimimum file size validation?

    Hello,

     

    I am looking to purchase the Uploader and I have few questions. I know it does a maximum file size test.

     

    I want to know if it can do a mimimum file size validation. ie I only want images that are larger than 200mb ... is this possible?

     

    Thanks

     

    David 

  •  08-19-2013, 1:13 PM 77864 in reply to 77860

    Re: Can it do mimimum file size validation?

    Hi David,

     

    You can get the file size and valid it before the file save into your server. if too small, show the error message.

     

    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>  
    7.             example  
    8.         </title>  
    9.     </head>  
    10.     <body>  
    11.   
    12.         <form id="form1" method="POST">  
    13.             <?php                  
    14.                     $uploader=new PhpUploader();  
    15.                     $uploader->Name="myuploader";  
    16.                     $uploader->MultipleFilesUpload=true;  
    17.                     $uploader->Render();  
    18.             ?>  
    19.         </form>  
    20.   
    21.   
    22.         <?php  
    23. $fileguidlist=@$_POST["myuploader"];  
    24. if($fileguidlist)  
    25. {  
    26. $guidlist=explode("/",$fileguidlist);     
    27.     foreach($guidlist as $fileguid)      
    28.     {      
    29.           
    30.         //get the uploaded file based on GUID         
    31.         $mvcfile=$uploader->GetUploadedFile($fileguid);         
    32.         if($mvcfile)         
    33.         {         
    34.             $size=$mvcfile->FileSize/1024;  
    35.             if($size>22)  
    36.             {  
    37.                //show error message  
    38.             }  
    39.             else  
    40.             {  
    41.                 //save the upload file  
    42.                 //$mvcfile->CopyTo("savefiles/".$mvcfile->FileName);   
    43.             }  
    44.                      
    45.         }      
    46.     }      
    47.   
    48. }  
    49. ?>  
    50.   
    51.         </div>  
    52.     </body>  
    53. </html>  
     

    Regards,

     

    Ken 

View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems