Re: Limit number of photos

  •  03-18-2011, 3:48 PM

    Re: Limit number of photos

    Dear cyberguy28,
     
    Yes, you can limit the number of photos, you can create custom file handler. Please refer to the following snippet:

    Custom file upload handler

    If you need further control over the parsing of the file uploading request, you can write a custom file upload handler. In handler page (UploadUrl) developers can rename the uploaded files, process other logics programmatically.

    1. <?php require_once "phpuploader/include_phpuploader.php" ?>   
    2. <html>   
    3. <body>   
    4.        <?php   
    5.             $uploader=new PhpUploader();   
    6.             $uploader->Name="myuploader";   
    7.             //Create a new file upload handler   
    8.             $uploader->UploadUrl="myhandler.php";   
    9.             $uploader->Render();   
    10.         ?>                  
    11. </body>   
    12. </html>  
    The following code shows you how to rename the uploaded files, process other logics programmatically in handler page (UploadUrl).
    You can put the validation of photo number in the following file:

     

    1. <?php require_once "phpuploader/include_phpuploader.php" ?>   
    2. <?php   
    3.     $uploader=new PhpUploader();   
    4.   
    5.     $mvcfile=$uploader->GetValidatingFile();   
    6.   
    7.     if($mvcfile->FileName=="accord.bmp")   
    8.     {   
    9.      $uploader->WriteValidationError("My custom error : Invalid file name. ");   
    10.          exit(200);   
    11.     }   
    12.   
    13.     //USER CODE:   
    14.   
    15.     $targetfilepath"savefiles/myprefix_" . $mvcfile->FileName;   
    16.     ifis_file ($targetfilepath) )   
    17.      unlink($targetfilepath);   
    18.     $mvcfile->MoveTo( $targetfilepath );   
    19.   
    20.     $uploader->WriteValidationOK();   
    21.   
    22. ?>  
     
    Thank you for asking
View Complete Thread