Welcome Guest, Not a member yet? Register   Sign In
File uploading save file as
#1

[eluser]neosable[/eluser]
How do I set the name of the file when using the file upload class?
thanks
#2

[eluser]Colin Williams[/eluser]
Are you familiar with how PHP handles file uploads? It saves the posted files to a temporary folder and then it is up to the given script to move those files over to a permanent location. CI's file uploading simple mitigates that process through a clear API.

So, just rename the file(s) after "uploading" them. Use the [url="http://us2.php.net/rename"]rename()[/url] function, believe it or not! Tongue
#3

[eluser]neosable[/eluser]
so basically instead of saving the file to windows/temp (in case of windows user) CI saves the file to the folder I set in the configand then I have to move it .
#4

[eluser]Colin Williams[/eluser]
Oy.. no, CI moves it to $config['upload_path']

By the way, someone just extended CI's uploader class to allow for custom renaming, which he claims is set up to automatically handle filename clashes.. check it at http://ellislab.com/forums/viewthread/89603/




Theme © iAndrew 2016 - Forum software by © MyBB