php - Multiple input file upload -


i'm trying create part of form uploads 5 images. @ moment i'm trying fix validation of images. 5 images can uploaded, form contains 5 input fields these (i know can upload multiple files in 1 input design designed this, not choice).

so firstly check see if image checkbox has been checked (this runs fine) , try , check see if there image uploaded, , each 1 image try , run basic validation (file size & type).

$imagesarray = array("order-desc-img", "order-desc-img-1","order-desc-img-2",                 "order-desc-img-3", "order-desc-img-4"); //names of file inputs     if (isset($_post['images'])){ //check checkbox             $imagesquantity = 1; //update variable show has been checked          foreach ($imagesarray $image) { //loop through each item in array                 $image_target_dir = "../uploads/images/";                 $image_name = basename($_files[$image]["name"]);                 $image_target_file = $image_target_dir . date('m-d-y_hia') . '_' . $image_name;              if ($image_name != ''){ //if no name file input                 $imagefiletype = pathinfo($image_target_file,pathinfo_extension);                  if ($_files[$image]["size"] > 5000000000) {                     $errors++;                 };//place holder file size check                  if($imagefiletype != "jpg" && $imagefiletype != "jpeg" && $imagefiletype != "png") {                     $errors++;                 };//placeholder file type check              }         }  }; 

however if try upload 1 image validation fails. if try upload 5 i'm not sure happens, stops on validation page , never reaches header failing or successing. i'm not great debugging i'm not sure how figure out i'm doing wrong. going wrong way?

any appreciated.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -