how i change file name before upload

Last post 01-21-2012, 12:24 AM by Debradebra123. 2 replies.
Sort Posts: Previous Next
  •  12-23-2011, 11:39 AM 72422

    how i change file name before upload

    suppose , i upload cat.jpg file . i want this file name will be 1.jpg in sava directory .
  •  12-26-2011, 1:46 AM 72426 in reply to 72422

    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 
  •  01-21-2012, 12:24 AM 72778 in reply to 72422

    Re: how i change file name before upload

    its not difficult like that.
    professional website design
View as RSS news feed in XML