Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validation with file uploads

Status
Not open for further replies.

SPYDERIX

Technical User
Joined
Jan 11, 2002
Messages
1,899
Location
CA
Hi,

Is the correct way to tell if a "file" form field is filled in or not to use this:

if (is_uploaded_file($_FILES["userfile"]["tmp_name"]))

The commands: isset, empty, eregi aren't accurately telling me if the field is filled in or not using either $_POST["userfile"] or $_FILES["userfile"] variables.

What is the correct way to check this?

Thanks!

Nate

mainframe.gif

 
well what u have done is correct. but there is another way using javascript and hidden fields. if the file field is empty then set the hidden filed value to empty and vice versa. read the hidden field value and check accordingly....

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top