en daarnaast worden ze nog in grootte aangepast
de meerder upload werkt tot op 8 geselecteerde bestanden??
en dan krijg ik volgende melding
Notice: Undefined index: uploaded_file in xxxxxxxxxxxxx on line 2 Warning: Invalid argument supplied for foreach() in xxxxxxxxxxxxxx on line 2
waarom krijg ik vanaf 8 bestanden deze foutmelding? gemiddelde grootte van files is +- 5 MB
<?php
foreach($_FILES['uploaded_file']['name'] as $key => $tmp_name )
{
$fileName = $key.$_FILES['uploaded_file']['name'][$key];
$fileSize =$_FILES['uploaded_file']['size'][$key];
$fileTmpLoc =$_FILES['uploaded_file']['tmp_name'][$key];
$fileType=$_FILES['uploaded_file']['type'][$key];
$fileErrorMsg = $_FILES["uploaded_file"]["error"][$key];
$kaboom = explode(".", $fileName); // Split file name into an array using the dot
$fileExt = end($kaboom); // Now target the last array element to get the file extension
$fileTmpLoc1 = imagecreatefromstring(file_get_contents($_FILES['uploaded_file']['tmp_name'][$key]));
$exif = exif_read_data($_FILES['uploaded_file']['tmp_name'][$key]);
sleep(1);
if(!empty($exif['Orientation'])) {
switch($exif['Orientation']) {
case 8:
$fileTmpLoc1 = imagerotate($fileTmpLoc1,90,0);
break;
case 3:
$fileTmpLoc1 = imagerotate($fileTmpLoc1,180,0);
break;
case 6:
$fileTmpLoc1 = imagerotate($fileTmpLoc1,-90,0);
break;
}
}
imagejpeg($fileTmpLoc1,$fileTmpLoc);
// START PHP Image Upload Error Handling --------------------------------------------------
if (!$fileTmpLoc) { // if file not chosen
echo "ERROR: Please browse for a file before clicking the upload button.";
exit();
} else if($fileSize > (1024*7000)) { // if file size is larger than 5 Megabytes
echo "ERROR: Your file was larger than 7 Megabytes in size.";
unlink($fileTmpLoc); // Remove the uploaded file from the PHP temp folder
exit();
} else if (!preg_match("/.(gif|jpg|png)$/i", $fileName) ) {
// This condition is only if you wish to allow uploading of specific file types
echo "ERROR: Your image was not .gif, .jpg, or .png.";
unlink($fileTmpLoc); // Remove the uploaded file from the PHP temp folder
exit();
} else if ($fileErrorMsg == 1) { // if file upload error key is equal to 1
echo "ERROR: An error occured while processing the file. Try again.";
exit();
}
$newfileName=$key."-".date("m").time().".".$fileExt;
// END PHP Image Upload Error Handling ----------------------------------------------------
// Place it into your "uploads" folder mow using the move_uploaded_file() function
$moveResult = move_uploaded_file($fileTmpLoc, "../../../../gallerij/webpic/$newfileName");
// Check to make sure the move result is true before continuing
if ($moveResult != true) {
echo "ERROR: File not uploaded. Try again.";
unlink($fileTmpLoc); // Remove the uploaded file from the PHP temp folder
exit();
}
unlink($fileTmpLoc); // Remove the uploaded file from the PHP temp folder
// ---------- Include Universal Image Resizing Function --------
include_once("resize.php");
$target_file = "../../webpic/$newfileName";
$resized_file = "../../webpic/$newfileName";
$wmax = 1000;
$hmax = 700;
ak_img_resize($target_file, $resized_file, $wmax, $hmax, $fileExt);
?>
Toevoeging op 21/03/2016 20:53:28:
als mijn foto's kleiner (5kb) zijn dan lukt de script tot 20 stuks, en dan stopt het zonder fout boodschap