Re: FilePath and FileNameAutoGenerate ?

  •  05-04-2010, 1:38 PM

    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

View Complete Thread