View Full Version : 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-14-2005, 12:15 AM
I dont understand, why wouldn't something like:
$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:
Do the trick?
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.