hey guys. I'm working on a script that would allow users to upload files to a directory. What I want is to have users be able to choose the following items:
Year of the photo,
Category of the photo,
Event photo was taken at
Now, I need to create a folder that will store these photos.
$updir = $_SERVER['DOCUMENT_ROOT'].'/images/photos/'.$year.$cat.$evt;
To check to see if the folder exists:
fopen($updir, 'w+');
/* From what I understand, w+ will look for the folder, and if it is not present, create it.*/
CHMOD($updir, 755);
/* Change the permissions to 755 so that people can write to it. */
fclose($updir);
Now, here's my question. I need to chmod the folder $updir, is what I have correct? And is my fopen() function proper? THis is just a check. I haven't tested yet as I'm in the very early stages. Thanks for the help.
EDIT
Would I even need to make it writable? If all uploads go to a temp directory by default, and I'm moving the file from there to the $updir, would I need to CHMOD it? So I guess the real question is: Do I need to do CHMOD() and if not, is that fopen the best way to check to see if the directory is there and if not create it?
~Brett