0

I need to upload 25 images on a form, the images names are 1 through to 25 hence the array. It seams to successfully upload all images up to number 9, then when it gets to uploading number 10 it just displays a blank white page and stops.

Here is the array and php upload:

$imageuploadarray = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25);
foreach($imageuploadarray as $imagenumber) {
    if(empty($_FILES["image$imagenumber"])) {
        //$imagemessagebad = 'Error!';
    } else {
        $fileName = $imagenumber.'.jpg';
        $fileTmpLoc = $_FILES["image$imagenumber"]["tmp_name"];
        $fileType = $_FILES["image$imagenumber"]["type"];
        $fileSize = $_FILES["image$imagenumber"]["size"];
        $fileErrorMsg = $_FILES["image$imagenumber"]["error"];
        $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
        if(!$fileTmpLoc) {
            $imagemessagebad = 'Error - Please Select An Image!';
            exit();
        } elseif(!preg_match("/.(jpg)$/i", $fileName) ) {   
            $imagemessagebad = 'Error - Wrong Image Type!';
            unlink($fileTmpLoc);
            exit(); 
        } elseif($fileErrorMsg == 1) {
            $imagemessagebad = 'Error Processing Image!';
            exit();
        }
        $moveResult = move_uploaded_file($fileTmpLoc, "/xampp/htdocs/techbite/articles/reviews/reviews/$catagoryprocess/$titleprocess/big/$fileName");
        if($moveResult != true) {
            $imagemessagebad = 'Error Uploading Image!';
            unlink($fileTmpLoc);
            exit();
        } else {
            //unlink($fileTmpLoc);
        }
        if($fileErrorMsg == 0) {
            $thumbnailmessagegood = 'The image '.$fileName.' has been uploaded!';
        } else {
            $thumbnailmessagebad = 'Error Uploading Image!';
        }
    }
}

As i said it works perfectly for single images and multiple. but as soon as it hits number 10 it displays a white blank page and stops.

royhowie
  • 11,075
  • 14
  • 50
  • 67
  • white page of death, error reporting\display are off, turn them on `error_reporting(E_ALL); ini_set('display_errors', 1);` –  Dec 12 '14 at 00:41
  • 1
    Maybe the max execution time is being exceeded? [PHP: set_time_limit](http://php.net/manual/en/function.set-time-limit.php) – showdev Dec 12 '14 at 00:42
  • Ill add error reporting now and no the execution time is fine, iv tried that and many other properties in php.ini with no luck – haydenbarton96 Dec 12 '14 at 00:49

0 Answers0