Prevent execution of uploaded php files?

前端 未结 3 1808
星月不相逢
星月不相逢 2021-01-01 00:13

In my project users are allowed to upload files of any type. I need to ensure security against execution of uploaded files that can parsed by php (*.php, *.html, etc.)

3条回答
  •  死守一世寂寞
    2021-01-01 00:40

    Keep them all under the same folder and set this line in the directory's .htaccess file:

    php_flag engine off
    

    That will also take care of other exploits such as embedding PHP code in .gif files.

提交回复
热议问题