I did the same upload form for photo uploading like here. Is it everything I can do to protect my website or I need to add something? Thank you very much.
Share
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.
I’d say no. There are checks in there for restricting the type of the file being uploaded:
That “type” is provided by the browser and can’t be relied on for security purposes. Someone could easily hack something together that sent an executable file with a type of “image/gif” and the script would happily accept it.
A better check would be to use something like
getimagesizeor one of the other GD functions to verify that it is actually an image.