Simple question. Is there a way to only allow txt files upon uploading? I’ve looked around and all I find is text/php, which allows PHP.
$uploaded_type=="text/php
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When you upload a file with PHP its stored in the $_FILES array. Within this there is a key called “type” which has the mime type of the file EG
$_FILES['file']['type']So to check it is a txt file you do
It’s explained very well here. Also, don’t rely on file extentions it’s very unreliable.