Jump to content

Recommended Posts

Posted

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?

Posted

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;

 

???

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...