I have a script which takes a file, renames it to the current time and uploads it. Now here's the key bit for uploading:
if (!empty($_FILES['ufile']['name'][0]))
{
$picunique = time();
$picture = "files/$picunique";
move_uploaded_file ($_FILES['ufile']['tmp_name'][0], $picture);
}
As you can see if the upload field is not empty I take the file and change the filename to the current time and moves the picture, which works great.
But i'm using the script to upload a variery of files ie a jpg, pdf etc...
So when I'm re-naming the file is there a way I can keep the file extension on the end that's on the original? ie so it's renamed to the time().jpg or time().pdf (ie whatever filetype was uploaded?)
Thanks