0
<input name= "p_image[]" type="file" id="p_image[]">

i need that user upload atleast one image and if it doesn't it show error..

2 Answers 2

2

You can check the count of the array, and if it's equal to 0, then throw an error:

<?php

   if(isset($_POST['p_image'])) { 
      if(!(count($_POST['p_image']))) {
          //throw error here...
      }
   } else {
     //throw another error here...
   }
?>
Sign up to request clarification or add additional context in comments.

3 Comments

again same problem arise's when i upload one image it show error not submit the form
Isn't that what you asked for? Please clarify.
i want that when user upload one image it's submit the form
0
<?php

   if(!isset($_POST['p_image'])) { 

          //failure messgae

   }
?>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.