move_uploaded_file
will 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 :
if (move_uploaded_file($file['tmp_name'], $folder . '1.jpg')) {
copy($folder . '1.jpg', $folder . '2.jpg');
copy($folder . '1.jpg', $folder . '3.jpg');
}
This would allow you to get the checks provided by move_uploaded_file
...
If this doesn't work, then, make sure that :
$folder
contains what you want -- including the final /
- That
$file['tmp_name']
also contains what you want (I'm guessing this is some kind of copy of $_FILES
-- make sure the copy of $_FILES
to $file
is done properly)