Categories:
Cloud (161)
Entertainment (11)
Facebook (43)
General (16)
Life (30)
Programming (33)
Technology (224)
Testing (4)
Tools (431)
Twitter (5)
Wearable (26)
Web Design (9)
Collections:
Other Resources:
The Real Way To Check Uploaded File Type
Useful PHP Code Snippets for Developers - The Real Way To Check Uploaded File Type
✍: Guest
<?php // Here we specify all the type of files we want to accept $extension = array("application/pdf", "image/jpeg", "image/png", "image/gif"); if(isset($_POST['submit'])){ exec("file -i ".$_FILES['inputName']['tmp_name'], $output); $type = explode(':', (string)$output[0]); } // Here we check our file with our needs if (isset($_FILES['inputName']) && $_FILES['inputName']['error'] == UPLOAD_ERR_OK && $_FILES['inputName']['size'] <= 10000000 && in_array(trim($type[1]), $extension)){ var_dump($_FILES['inputName']['tmp_name']); }else{ die("File Error"); }
2015-07-01, 1335👍, 0💬
Popular Posts:
Why I am getting the "run or save ChromeSetup.exe" pop up box when trying to install Google Chrome 3...
Why am I not seeing the "Call Forwarding" option on Skype for Business on Windows? You don't see the...
I have an Apple iPad Air Model MD788C/A. Is it good? Yes. Apple iPad Air Model MD788C/A is a very go...
What is "OneNote Linked Notes Add-in" in Microsoft Word? Should I disable it? "OneNote Linked Notes ...
How to create two columns in Microsoft Word documents? If you want to make a part of a Word document...