tags:

views:

26

answers:

2
<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..

+1  A: 

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...
   }
?>
Jacob Relkin
again same problem arise's when i upload one image it show error not submit the form
Bhanu
Isn't that what you asked for? Please clarify.
Jacob Relkin
i want that when user upload one image it's submit the form
Bhanu
A: 
<?php

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

          //failure messgae

   }
?>
Richa