Script below is not working. Not getting any php error messages. Had asked a similar question, changed around thumbnail creation and if I had updated that question it would not have been seen at all.
Code is not getting past file type check. The input type of file has a name of multifile[].
if ((($_FILES['multifile']['type'][$key] == "image/png") ||
($_FILES['multifile']['type'][$key] == "image/jpeg") ||
($_FILES['multifile']['type'][$key] == "image/pjpeg") &&
($_FILES['multifile']['size'][$key] < 2097152)))
{
if(count($_FILES['multifile']['name']))
{
foreach ($_FILES['multifile']['name'] as $key => $filename)
{
$filename = time().'_'.$_FILES['multifile']['name'];
$source = $_FILES['multifile']['tmp_name'];
$target = 'uploads/'.$filename;
if(move_uploaded_file ($_FILES['multifile']['tmp_name'][$key],$target))
{
createThumbnail($filename);
//database insert here
echo '<div class="success" style="margin-right:25px;">Images added, view individual album to edit image descriptions</div>';
}
}
}
}
else
{
echo '<div class="error">Invalid file, only jpg, jpeg, or png file types allowed</div>';
}
Here is print_r of $_FILES
Array ( [name] => Array ( [0] => image1.png [1] => image2.png ) [type] => Array ( [0] => image/png [1] => image/png ) [tmp_name] => Array ( [0] => /tmp/php1rPxh5 [1] => /tmp/phpsGsA2I ) [error] => Array ( [0] => 0 [1] => 0 ) [size] => Array ( [0] => 27594 [1] => 24466 ) )