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?
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; ???
Johnny2 Posted March 27, 2013 Author Report Posted March 27, 2013 I ended up figuring it out. This works: if($_FILES['img1']['tmp_name'] == ""){}
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now