php - input type file Isset returning false even when set -


i uploading picture, isset() returns false when picked file. here code.

<form id="form1" name="form1" method="post" enctype="multipart/form-data"    action="addroom.php"> <p>upload pictures:</p> <p>bed:</p> <input type="file" name="image1"/> <p>comfort room</p> <input type="file" name="image2"/> <p>living room:</p> <input type="file" name="image3"/>               <input type="submit" id="add" name="add" value="add room category"/> </form> <?php if(isset($_post['image1']))     $file1=$_files['image1']['name']; else     echo "image not selected"; 

uploaded files stored in $_files. $_post['image1'] not exist because file, not text (or other) field.

you want use either:

if(isset($_post['add'])) 

or

if(isset($_files['image1'])) 

Comments