Can't Upload more than 6 images from php Multiple Image Upload -


below code have tinkered , changed suit website needs. grabs images , uploads them individually, making thumbnail image , recoridng data database.

the trouble have when upload 5/6 @ time doesn't upload nor specify whats wrong. added (error_reporting(~0); ini_set('display_errors', 1);) check errors still nothing shone light going on.

any appreciated.

ps:- php.ini set to:-

upload_max_filesize = 60m   post_max_size = 60m max_execution_time = 90 max_file_uploads = 30 

php

$j = 0;      $target_path = "../../images/";      $newimagenumber=$currentimages; $imgname = 0; $imgfilename = 0; ($i = 0; $i < count($_files['file']['name']); $i++) {   $target_path = "../../images/";        $imgname = 0;   $imgfilename = 0;   $newimagenumber=$newimagenumber+1;   $imgname=$_post['filename'];   $validextensions = array("jpeg", "jpg", "png", "jpg");         $ext = explode('.', basename($_files['file']['name'][$i]));     $file_extension = end($ext);    $imgfilename="$imgname-$newimagenumber";   $imgfilenameext="$imgname-$newimagenumber.jpg";   $target_path = $target_path . $imgfilename . ".jpg";        $j = $j + 1;     if (($_files["file"]["size"][$i] < 5000000) && in_array($file_extension, $validextensions)) {     if (move_uploaded_file($_files['file']['tmp_name'][$i], $target_path)) {       $insertimgfile = mysql_query("insert image_data (image_url,image_name,image_customerid,filename) values ('$imgfilenameext','$imgfilenameext','$customer_id','$imgname')") or die(mysql_error());        include('createnails.php');       // if file moved uploads folder.       echo $j. ').<span id="noerror">image uploaded successfully!.</span><br/>';     } else {     //  if file not moved.       echo $j. ').<span id="error">please try again!.</span><br/>';     }   } else {     //   if file size , file type incorrect.     echo $j. ').<span id="error">***invalid file size or type***</span><br/>';   } } } 

if problem unable upload 6th file out of total 6 files problem here counter

for ($i = 0; $i < count($_files['file']['name']); $i++) { 

your number of file must less / equal counter or miss last file, suppose $_files['file'] 6 , counter 6 put condition < ignore 6th file, conidtion must <=

for ($i = 0; $i <= count($_files['file']['name']); $i++) { 

Comments