Johnny2 Posted March 25, 2013 Report Posted March 25, 2013 I have a form with an input field of type="file" name="img1" id="img1". When the form is submitted, I would like to make sure the user selected a file before my script continues. I've tried: if(!isset($_POST['img1'])){ $message="An image file was not selected."; } ...but that isn't working. What am I missing? Quote
Moloney Posted March 26, 2013 Report Posted March 26, 2013 I have a form with an input field of type="file" name="img1" id="img1". When the form is submitted, I would like to make sure the user selected a file before my script continues. I've tried: if(!isset($_POST['img1'])){ $message="An image file was not selected."; } ...but that isn't working. What am I missing? did you echo the $message? echo $message; ??? Quote
Johnny2 Posted March 27, 2013 Author Report Posted March 27, 2013 I ended up figuring it out. This works: if($_FILES['img1']['tmp_name'] == ""){} Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.