I’m going through some doubts about how do i need to set up my environment to be able to use this function correctly.
What i do really need is something like this:
I’m developing a classified website for my city, where each user has its id. When an user posts an ad, i have to take all the files he uploaded and move them to a new (or not new) directory.
The name of this directory is the user ID.
Does the function ‘move_uploaded_file’ create the directory if it does not exist?
If not, how could i do that?
Example:
//getUID() returns 5
//current directory: www/
move_uploaded_file('some_temp_file.ext','adimg/' . getUID() . '/new_file.ext');
Is it going to create the folder ‘5’ and move the temporary file to it?
And how do i need to configure my folders (I’m testing it under Windows).
Thanks!
Use php mkdir() function. before using
move_uploade_file()to create the directory(if you are creating the foler via php) where you want to put the files.If you cant edit the folder persisson by checkboxes, you can set it via ftp client.