Ok, here's the situation. I'm working on a little upload script and so far I have it working. It checks the file type and uploads to the correct directory and I have it add a row to the database which stores their username, which is what they're logged in as, the date they submitted the file and a unique ID, which is just mysql_insert_id(). The directory that everyone is uploading to is going to be the same, so I wanted to rename the file that they're uploading to something else, like their username, then after that the unique ID given to that file.
if(isset( $upload ))
{
if ($FILES['imagefile']['type'] == "image/x-png"){
copy ($FILES['imagefile']['tmp_name'], "images/screenshots/".$_FILES['imagefile']['name'])
or die ("Could not copy");
}
else{
blah blah not important
}
}
else{
blah blah blah not important
}
That's the main jist of the copying part. It gets the filename and file type from the form that the user submits, and it just copies it from that. What I want to do is just change the filename (imagefile) from what they submit to something unique so they don't overwrite any other files and it's in a somewhat organized fashion in the directory.
I appreciate the help :o