Re: how i change file name before upload

  •  12-26-2011, 1:46 AM

    Re: how i change file name before upload

    Hi fahim,
     

    The following code shows you how to rename the uploaded files, process other logics programmatically in handler page (UploadUrl).

     

    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. ?>  

     

     
    Regards,
     
    Ken 
View Complete Thread