{"id":72,"date":"2014-11-15T19:37:56","date_gmt":"2014-11-15T19:37:56","guid":{"rendered":"https:\/\/www.kolkataonweb.com\/code-bank\/?p=72"},"modified":"2014-11-15T19:37:56","modified_gmt":"2014-11-15T19:37:56","slug":"secure-upload-folders","status":"publish","type":"post","link":"https:\/\/www.kolkataonweb.com\/code-bank\/miscellaneous\/secure-upload-folders\/","title":{"rendered":"Secure Upload Folders"},"content":{"rendered":"<p>There are two ways to prevent execution of any (malicious) scripts uploaded to by users.<br \/>\nMethod one &#8211; like described <a href=\"https:\/\/www.kolkataonweb.com\/code-bank\/miscellaneous\/throw-scripts-as-text-instead-of-executing-it\/\" title=\"Throw scripts as text instead of executing it\">in this post<\/a>.<br \/>\nMethod two &#8211; add the below code to .htaccess file of the directory that needs to be protected.<\/p>\n<pre class='wp-code-highlight prettyprint'>RemoveHandler .cgi .php .php3 .php4 .php5 .phtml .pl .py .pyc .pyo .sh .html .shtml .jsp<\/pre>\n<p><em style=\"font-size:14px\">If it doesn&#8217;t work for PHP scripts on servers where suPHP is enabled, then see <a href=\"https:\/\/www.kolkataonweb.com\/code-bank\/php\/php-executing-rm-f-r-dirname-through-exec\/\" title=\"PHP executing rm -f -r dirname through exec\">this post<\/a><em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are two ways to prevent execution of any (malicious) scripts uploaded to by users. Method one &#8211; like described in this post. Method two &#8211; add the below code to .htaccess file of the directory that needs to be protected. RemoveHandler .cgi .php .php3 .php4 .php5 .phtml .pl .py .pyc .pyo .sh .html .shtml&hellip; <a class=\"more-link\" href=\"https:\/\/www.kolkataonweb.com\/code-bank\/miscellaneous\/secure-upload-folders\/\">Continue reading <span class=\"screen-reader-text\">Secure Upload Folders<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,3],"tags":[],"class_list":["post-72","post","type-post","status-publish","format-standard","hentry","category-miscellaneous","category-php","entry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/72","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/comments?post=72"}],"version-history":[{"count":3,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/72\/revisions"}],"predecessor-version":[{"id":75,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/72\/revisions\/75"}],"wp:attachment":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/media?parent=72"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/categories?post=72"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/tags?post=72"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}