I have this piece of code:
for($d = 0 ; $d < count($_FILES['uploadedfile']['name']) ; ++$d)
{ $imagenamecount = $d + 1;
$imagedetails = pathinfo( $_FILES['uploadedfile']['name'][$d]);
$finalpathfortempimagefile = $pathfortempimagefile."image"."$imagenamecount".".".$imagedetails['extension'];
if(!move_uploaded_file($_FILES['uploadedfile']['tmp_name'][$d], $finalpathfortempimagefile))
{
header('Location: http://localhost/stuff.php?ue=xx');
}
}
The main part of it revolves around using move_uploaded_file()
to rename and transfer multiple uploaded images. I had no problems with it on Chrome, Firefox, and Opera. But when I tested it on Safari header('Location: http://localhost/stuff.php?ue=xx');
was activated. (Haven't tested it on IE yet, its not opening.)
I have codes before the code provided above that deals with the uploaded files (checks for extensions and etc.) but it had no problems, no errors or whatever. Safari also had no problems with the file upload form:
<form enctype="multipart/form-data" action="post.php" method="POST">
<input id="uploadInput" name="uploadedfile[]" type="file" multiple>
<input class="submit_css" type="submit" value="PREVIEW POST">
</form>
So I think it really has something to do with the move_uploaded_file() function. Any ideas?
ADDITIONAL:
Tested it again with Safari but this time with only 1 image, test was successful no errors.
Tested it again but with multiple uploads (2 and 5), test was unsuccessful it redirected.
Tried both tests on the other browsers, test was successful.
Haven't tried it on IE yet still having trouble opening it.
EDIT
For the benefit of any future viewers of this post.
This is not a php problem of the move_uploaded_file() - I have just recently confirmed that it this was actually a SAFARI v5.1.+ BUG on the html5 multiple attribute. Few info here