Append file name on Upload - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Append file name on Upload (/showthread.php?tid=24784) |
Append file name on Upload - El Forum - 11-19-2009 [eluser]timj[/eluser] Hello, I am building a file Upload utility and would like to be able to modify the filename upon upload. The filename would be appended with the date of the upload. New to this. I see that orig_name is included in the Upload Class data array. I also see that the functionality to easily change a file name is built into the FTP Class. I don't see that it is built into the Upload Class. So my question is, should I be using the Upload or FTP class to achieve this result? Is appended_name something I can just add into the Upload Class data helper array? Append file name on Upload - El Forum - 11-19-2009 [eluser]Ben Edmunds[/eluser] It's already there. Just set $config['file_name']. If you have problems check line 933 in the upload library and make sure it is checking for $this->file_name. Append file name on Upload - El Forum - 11-19-2009 [eluser]timj[/eluser] Thanks; handy. But it doesn't seem to *quite* get to my problem, which is keeping the default file name while appending a date. If I rename the file_name, it overwrites the orig_name. What I'd like to do is keep the orig_name but append a date to the file_name. Append file name on Upload - El Forum - 11-20-2009 [eluser]Ben Edmunds[/eluser] To do that you'd probably be best off extending the upload library. |