<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Implementing Secure File Upload in PHP</title>
	<atom:link href="http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/</link>
	<description>Daily Blog from Internet Entrepreneur/Webmaster</description>
	<lastBuildDate>Wed, 16 May 2012 07:15:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Toby</title>
		<link>http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-26141</link>
		<dc:creator>Toby</dc:creator>
		<pubDate>Wed, 25 Apr 2012 10:12:48 +0000</pubDate>
		<guid isPermaLink="false">http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-26141</guid>
		<description>Checking for a file extension is not secure - it could be renamed.

Checking a header / content type is also not secure - a malicious script could also contain a jpg header and appear / behave like an image.</description>
		<content:encoded><![CDATA[<p>Checking for a file extension is not secure &#8211; it could be renamed.</p>
<p>Checking a header / content type is also not secure &#8211; a malicious script could also contain a jpg header and appear / behave like an image.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: apexsol</title>
		<link>http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-25668</link>
		<dc:creator>apexsol</dc:creator>
		<pubDate>Wed, 14 Mar 2012 07:39:07 +0000</pubDate>
		<guid isPermaLink="false">http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-25668</guid>
		<description>[code]
?php  
if($_FILES[&#039;userfile&#039;][&#039;type&#039;] != &quot;image/gif&quot;) {  
echo &quot;Sorry, we only allow uploading GIF images&quot;;  
exit;  
}  
$uploaddir = &#039;uploads/&#039;;  
$uploadfile = $uploaddir . basename($_FILES[&#039;userfile&#039;][&#039;name&#039;]);  
if (move_uploaded_file($_FILES[&#039;userfile&#039;][&#039;tmp_name&#039;], $uploadfile)) {  
echo &quot;File is valid, and was successfully uploaded.n&quot;;  
} else {  
echo &quot;File uploading failed.n&quot;;  
}  
?&gt;  
[/code]</description>
		<content:encoded><![CDATA[<pre class="brush: plain; title: CODE; notranslate">
?php
if($_FILES['userfile']['type'] != &quot;image/gif&quot;) {
echo &quot;Sorry, we only allow uploading GIF images&quot;;
exit;
}
$uploaddir = 'uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo &quot;File is valid, and was successfully uploaded.n&quot;;
} else {
echo &quot;File uploading failed.n&quot;;
}
?&gt;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: pbu</title>
		<link>http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-23935</link>
		<dc:creator>pbu</dc:creator>
		<pubDate>Sat, 18 Feb 2012 07:16:38 +0000</pubDate>
		<guid isPermaLink="false">http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-23935</guid>
		<description>It can put extra load on your server, if you too much use image processing library or if too many clients upload images at same time.</description>
		<content:encoded><![CDATA[<p>It can put extra load on your server, if you too much use image processing library or if too many clients upload images at same time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gal</title>
		<link>http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-23927</link>
		<dc:creator>gal</dc:creator>
		<pubDate>Sat, 18 Feb 2012 00:57:34 +0000</pubDate>
		<guid isPermaLink="false">http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-23927</guid>
		<description>i actually handled it a bit differently.
images are uploaded for specific causes, like user profile image, so i don&#039;t need to allow a complete directory file management.

* the file is uploaded to the temp directory.
* i&#039;m checking the mime type of the file.
* i&#039;m not copying the file to the destination folder. instead, i use the gd2 library to create a similar looking image using imagecopyresampled.

any thoughts?</description>
		<content:encoded><![CDATA[<p>i actually handled it a bit differently.<br />
images are uploaded for specific causes, like user profile image, so i don&#8217;t need to allow a complete directory file management.</p>
<p>* the file is uploaded to the temp directory.<br />
* i&#8217;m checking the mime type of the file.<br />
* i&#8217;m not copying the file to the destination folder. instead, i use the gd2 library to create a similar looking image using imagecopyresampled.</p>
<p>any thoughts?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: softboxkid</title>
		<link>http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-23068</link>
		<dc:creator>softboxkid</dc:creator>
		<pubDate>Thu, 08 Dec 2011 09:07:46 +0000</pubDate>
		<guid isPermaLink="false">http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-23068</guid>
		<description>Great article. I&#039;m going for the 2nd method.
Thanks</description>
		<content:encoded><![CDATA[<p>Great article. I&#8217;m going for the 2nd method.<br />
Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fap Turbo Discount</title>
		<link>http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-10265</link>
		<dc:creator>Fap Turbo Discount</dc:creator>
		<pubDate>Wed, 06 Oct 2010 15:44:37 +0000</pubDate>
		<guid isPermaLink="false">http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-10265</guid>
		<description>thanks for the great help for the beginner! Such a nice site for me… Thanks for the great info! You give more knowledge about the path I will going through. Hope to see this site successful in the near future.</description>
		<content:encoded><![CDATA[<p>thanks for the great help for the beginner! Such a nice site for me… Thanks for the great info! You give more knowledge about the path I will going through. Hope to see this site successful in the near future.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: deW</title>
		<link>http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-10172</link>
		<dc:creator>deW</dc:creator>
		<pubDate>Wed, 22 Sep 2010 01:30:11 +0000</pubDate>
		<guid isPermaLink="false">http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-10172</guid>
		<description>Thx, it was very helpful.</description>
		<content:encoded><![CDATA[<p>Thx, it was very helpful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lester lhory</title>
		<link>http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-8235</link>
		<dc:creator>lester lhory</dc:creator>
		<pubDate>Wed, 18 Aug 2010 07:40:59 +0000</pubDate>
		<guid isPermaLink="false">http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-8235</guid>
		<description>great article! Thanks for the suggestion!</description>
		<content:encoded><![CDATA[<p>great article! Thanks for the suggestion!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CUZIT</title>
		<link>http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-7779</link>
		<dc:creator>CUZIT</dc:creator>
		<pubDate>Wed, 28 Jul 2010 13:16:10 +0000</pubDate>
		<guid isPermaLink="false">http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-7779</guid>
		<description>Very Nice Articles</description>
		<content:encoded><![CDATA[<p>Very Nice Articles</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pbu</title>
		<link>http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-7653</link>
		<dc:creator>pbu</dc:creator>
		<pubDate>Fri, 09 Jul 2010 12:57:33 +0000</pubDate>
		<guid isPermaLink="false">http://corpocrat.com/2007/11/28/implementing-secure-file-upload-in-php/#comment-7653</guid>
		<description>Dont allow users to upload photos in GIF photos as it may contain harmful code. Allow only JPG and PNG</description>
		<content:encoded><![CDATA[<p>Dont allow users to upload photos in GIF photos as it may contain harmful code. Allow only JPG and PNG</p>
]]></content:encoded>
	</item>
</channel>
</rss>

