Jump to content

format array issue


divinedesigns1

Recommended Posts

ok im having this issue with the format that is in an array() when comparing it to the $_FILES type

$allowed = array('png', 'jpg', 'jpeg', 'gif');if($ptype != $allowed){ $errors[] = 'This format isnt allow</br>Accepted formats are as followed: PNG, JPG, JPEG, GIF';}

when i try to upload a .tiff, .doc, .txt file it still upload but once i upload the correct file it displays the error message

 

any tips, hint, advice on how i can go about fixing this?

Link to comment
Share on other sites

$ptype is never equal to $allowed because one is a string and one is an array (or so I assume). In what part of the code is $ptype being set?

 

If you want to check that a value exists in an array, then use in_array().

Link to comment
Share on other sites

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...