Jump to content
Sign in to follow this  
divinedesigns1

format array issue

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?

Share this post


Link to post
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().

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...