how can I copy two times the same file? I’m trying to do something like this:
copy($file['tmp_name'], $folder."1.jpg");
copy($file['tmp_name'], $folder."2.jpg");
copy($file['tmp_name'], $folder."3.jpg");
And how many time does temp files has before it’s destroyed by the server?
I try using move_uploaded_file also, but I can’t make it work. I want to generate 2 thumbs from an uploaded file.
Some help?
Thanks,
move_uploaded_filewill move the file, and not copy it — which means it’ll work only once.If you are using
copy, there shouldn’t be any limit at all on the number of times you can copy : the temporay file created by the upload will only be destroyed at the end of the execution of your script (unless you move/delete it before, of course)Still, maybe a solution would be to use `move_uploaded_file` first, and, then, `copy` ?
A bit like that, I suppose :
This would allow you to get the checks provided by
move_uploaded_file…If this doesn’t work, then, make sure that :
$foldercontains what you want — including the final/$file['tmp_name']also contains what you want (I’m guessing this is some kind of copy of$_FILES— make sure the copy of$_FILESto$fileis done properly)