Search code examples
phpsecurityfile-uploadblocking

Is it possible to block php scripts in upload folder?


I'm experiencing my first form in php where images can be uploaded.

I've seen some article on the web which explains it can be dangerous, so there is some way to block scripts on a specified folder? Something with .htaccess or php .ini instruction?


Solution

  • The VERY best way is to make sure that your upload directory is outside of your webroot. As long as the webserver has read/write access there you will be fine - no worries about executable uploads. This was discussed here on stackoverflow.