Jump to content

File upload restriction


aashcool198

Recommended Posts

Hi All,

i have a file-upload script and this is code for restricting file types  it is accepting pdf but denying docx.. please tell me what is going wrong.

 

if ((($_FILES["file"]["type"] == "application/pdf")
|| ($_FILES["file"]["type"] == "application/doc")
|| ($_FILES["file"]["type"] == "application/docx"))
&& ($_FILES["file"]["size"] < 200000))

Link to comment
https://forums.phpfreaks.com/topic/164630-file-upload-restriction/
Share on other sites

When a comparison fails, the only 100% sure way to find out why is to display the actual value that is failing the test. Try this debugging code before your existing logic to see what you are actually receiving -

 

echo "<pre>";
echo "FILES:";
print_r($_FILES);
echo "</pre>";

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.