How to prevent a specific directory from running Php, Html, and Javascript languages?
Posted
by Emily
on Stack Overflow
See other posts from Stack Overflow
or by Emily
Published on 2010-04-11T22:14:16Z
Indexed on
2010/04/11
22:23 UTC
Read the original article
Hit count: 195
Hi, Let's say i have an image uploader script, i want to prevent the upload directory from executing Php or even html by only showing it as plain text, i've seen this trick in many websites but i don't know how they do it.
Briefly, if i upload evil.php
to that directory, and i try to access it i will only see a plain text source , No html or php is executed. ( but i still want the images to appear normally ofcourse)
I know i can do like that by header("content-type:text/plain");
but that's will not be helpful, because what i want, is to set the content-type:text/plain
automatically by the server for every thing outputed from the upload directory except images.
Note: i'm running php 5.3.2/Cent OS and the latest cPanel.
Thanks
© Stack Overflow or respective owner