Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Renaming upload files
06-13-2005, 08:35 AM #1
- Join Date
- Jun 2005
- Thanked 0 Times in 0 Posts
Renaming upload files
can anyone help me with my renaming method..here is the current code i use to upload files http://pastebin.ca/14234, and i'm attempting to make it so each file is renamed to a number and then attached with the appropiate extension so far i have this..but it doesn't work at all..here is what i got so far...http://pastebin.ca/14235
Thanks in advance for the help.
06-13-2005, 11:15 PM #2
I dont understand, why wouldn't something like:
Do the trick?PHP Code:
$userfile = "user_uploaded_file.html";
$ext = substr($userfile, strrpos($userfile,"."));
$time = time();
$newname = $time.$ext;
And of course you'd copy the uploaded file and put it where you wanted it...
copy($file_temp, "$newname") or die('could not upload file');
Your file is named: $userfile
It has a $ext extension
I will rename your file: