A
A
Alexey2015-09-24 01:37:44
PHP
Alexey, 2015-09-24 01:37:44

Is checking the type of files sufficient?

Users have the ability to upload pictures to the site. Is such a check on the pictures enough?

if  ((( $_FILES [ "file" ][ "type" ]  ==  "image/gif" ) 
||  ( $_FILES [ "file" ][ "type" ]  ==  "image/jpeg" ) 
||  ( $_FILES [ "file" ][ "type" ]  ==  "image/jpg" ) 
||  ( $_FILES [ "file" ][ "type" ]  ==  "image/png" ))

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Varakosov, 2015-09-24
@dzheka3d

The most effective option is to prohibit the execution of code from the downloads folder. For example, using rules in .htaccess.

T
TheLostRoot, 2015-09-24
@TheLostRoot

habrahabr.ru/post/44610

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question