So far I've got it working pretty well, however I'm wondering about how to rename the file once uploaded.
As for generating, I've gone pretty basic and just done current time + random number between 1 and 100. Simple enough.
What I'm doing is once the file is succesfully uploaded, renameUpload(); then move_uploaded_file etc.
This is the function in all it's glory:
Code: Select all
function renameUpload($file) {
$rand = mt_rand(100, 999);
$time = time();
$ext = strstr($file,'.');
$filenew = $rand.$time.$ext;
rename($file, $filenew);
}Code: Select all
else {
renameUpload($name);
move_uploaded_file($temp,"files/".$name);
echo $success;
}The problem is, when I run it I get this error:
Warning: rename(clark!.fla,1941257376894.fla) [function.rename]: No such file or directory in C:\xampp\htdocs\swfshire\upload.php on line 46
I'm not quite sure why.
Any suggestions? I'm pretty lost here, and most likely missing a trick.