Welcome Guest, Not a member yet? Register   Sign In
File Upload Class: Pass in new file name
#2

[eluser]Chris Newton[/eluser]
Upon upload, you could rename the file, using a native PHP method.

Code:
$file_data=$this->upload->data();
rename($file_data['file_name'], 'new_name'.$file_data['file_ext']);


The upload class can rename a file to keep from overwriting an existing file anyway, so there's no fear of tacking this on, post-upload. Doing the above way is quick and easy, but might be more computationally expensive than having a config option for the upload class that does the same thing.


Messages In This Thread
File Upload Class: Pass in new file name - by El Forum - 06-24-2008, 07:28 AM
File Upload Class: Pass in new file name - by El Forum - 06-25-2008, 08:42 PM
File Upload Class: Pass in new file name - by El Forum - 06-26-2008, 02:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB