FilePath and FileNameAutoGenerate ?

Last post 05-05-2010, 4:54 PM by Apfelfrucht. 5 replies.
Sort Posts: Previous Next
  •  05-01-2010, 1:02 AM 60584

    FilePath and FileNameAutoGenerate ?

    Hello,
     
    I have checked out your impressive products and i wonder ask some questions below before purchasing the PHP Uploader :
     
    Is it possible to have the "FileNameAutoGenerate", i mean the name of the file uploaded will have a name automatically generated ? Then after the file is uploaded, it displays automatically the "FilePath (link to display the file)".

    i.e : I've already uploaded the file named "abc.jpg" yesterday and today i've the same file named "abc.jpg" and i want that today file name will be auto generated like to "abc-15465326.jpg", so my yesterday file name will not be overwrited. Is that possible ?
     
    Other question is : Could i upload the file name with accent ? Like : é, à, ù, ç, etc.
     
    Regards.
     
  •  05-04-2010, 1:38 PM 60681 in reply to 60584

    Re: FilePath and FileNameAutoGenerate ?

    >>Is it possible to have the "FileNameAutoGenerate", i mean the name of the file uploaded will have a name automatically generated ? Then after the file is uploaded, it displays automatically the "FilePath (link to display the file)".

     
    Yes. You need to create a custom file upload handler which allows you rename the uploaded files.
     
    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. ?>     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  05-05-2010, 1:53 AM 60698 in reply to 60681

    Re: FilePath and FileNameAutoGenerate ?

    Hello Adam,
     
    Your codes displayed above  are for "Generating a file name automatically" or for "Renaming a file after upload" ?
     
    I'd like the example below :

    i.e : I've already uploaded the file named "abc.jpg" yesterday and today i've the same file named "abc.jpg" and i want that today file name will be auto generated like to "abc-15465326.jpg", so my yesterday file name will not be overwrited.
     
    Regards.
  •  05-05-2010, 8:43 AM 60714 in reply to 60698

    Re: FilePath and FileNameAutoGenerate ?

    Apfelfrucht,
     
    The above code shows you it's possible to rename the uploaded file name.
     
    For your questions, you can check the file name exists in the target folder or not.

    If yes, rename the new files with any name you like.

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  05-05-2010, 4:54 PM 60756 in reply to 60714

    Re: FilePath and FileNameAutoGenerate ?

    I see. Ok i'll go test it ;)
     
    Thanks !
View as RSS news feed in XML