I'm getting confused while working with an file upload HTML form and some PHP to handle the input. In the form i have two file selects for images. When uploading an .png file i can get the file size etc using $_FILES. But when i'm trying to upload an .jpg file, i can't get more then the filename, no size, type, temporary name.
And when uploading two files at once, .png and .jpg, everything works for the .png file but not the .jpg.
What am i missing here? Are there any "restrictions when using $_FILES with .jpg filetypes or something else that i'm not aware of?
Example code:
if (isset($_FILES['upload1'])) { // JPG FILE
$fileName1 = $_FILES['upload1']['name'];
$fileSize1 = $_FILES['upload1']['size'];
echo $fileName1;
echo $fileSize1;
}
if (isset($_FILES['upload2'])) { // PNG FILE
$fileName2 = $_FILES['upload2']['name'];
$fileSize2 = $_FILES['upload2']['size'];
echo $fileName2;
echo $fileSize2;
}
outputs something like (without the brackets):
"filename1.jpg" "0" "filename2.png" "12313"
print_r($_FILES) outputs:
Array (
[upload1] => Array (
[name] => volvo1.png
[type] => image/png
[tmp_name] => C:\wamp\tmp\php14AD.tmp
[error] => 0
[size] => 6380 )
[upload2] => Array (
[name] => IMG0379.JPG
[type] => [tmp_name] =>
[error] => 1
[size] => 0 )
)
print_r($_FILES)
and check the whole array. – Maulik Voravar_dump($_FILES);
to see all of it. – Halcyon$_FILES['upload1']['error'];
? – Pekka