<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: More secure PHP image upload class tutorial</title>
	<link>http://kreoton.net/more-secure-php-image-upload-class-tutorial-8.html</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Wed, 20 Aug 2008 02:21:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2</generator>

	<item>
		<title>By: sigam</title>
		<link>http://kreoton.net/more-secure-php-image-upload-class-tutorial-8.html#comment-1384</link>
		<author>sigam</author>
		<pubDate>Fri, 16 May 2008 20:47:51 +0000</pubDate>
		<guid>http://kreoton.net/more-secure-php-image-upload-class-tutorial-8.html#comment-1384</guid>
		<description>To treat user uploaded image files (gif/jpg/png only) I do as below:

- get basename.
- determine type using exif_imagetype().
- if result is neither IMAGETYPE_GIF nor IMAGETYPE_JPEG nor IMAGETYPE_PNG, discard file.
- give my own name to file with correct extension (see above).
- it\'s now safe to store within a public folder where browsers can access them as images.

I have also read suggestions to chmod the stored files to prevent execution, but I\'m not sure how it improves security as properly named gif/jpg/png files won\'t get executed. Also I believe the files are 644 by default.</description>
		<content:encoded><![CDATA[<p>To treat user uploaded image files (gif/jpg/png only) I do as below:</p>
<p>- get basename.<br />
- determine type using exif_imagetype().<br />
- if result is neither IMAGETYPE_GIF nor IMAGETYPE_JPEG nor IMAGETYPE_PNG, discard file.<br />
- give my own name to file with correct extension (see above).<br />
- it\&#8217;s now safe to store within a public folder where browsers can access them as images.</p>
<p>I have also read suggestions to chmod the stored files to prevent execution, but I\&#8217;m not sure how it improves security as properly named gif/jpg/png files won\&#8217;t get executed. Also I believe the files are 644 by default.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Green Bang</title>
		<link>http://kreoton.net/more-secure-php-image-upload-class-tutorial-8.html#comment-1062</link>
		<author>Green Bang</author>
		<pubDate>Fri, 18 Apr 2008 14:01:06 +0000</pubDate>
		<guid>http://kreoton.net/more-secure-php-image-upload-class-tutorial-8.html#comment-1062</guid>
		<description>I have a doubt in the above code.

What if the names are same? I mean say we upload a file named \</description>
		<content:encoded><![CDATA[<p>I have a doubt in the above code.</p>
<p>What if the names are same? I mean say we upload a file named \</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Code</title>
		<link>http://kreoton.net/more-secure-php-image-upload-class-tutorial-8.html#comment-1039</link>
		<author>Code</author>
		<pubDate>Wed, 16 Apr 2008 13:01:44 +0000</pubDate>
		<guid>http://kreoton.net/more-secure-php-image-upload-class-tutorial-8.html#comment-1039</guid>
		<description>i have a problem with exif in function exif...exif is enable.
more example to use exif?

thx</description>
		<content:encoded><![CDATA[<p>i have a problem with exif in function exif&#8230;exif is enable.<br />
more example to use exif?</p>
<p>thx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Schulz</title>
		<link>http://kreoton.net/more-secure-php-image-upload-class-tutorial-8.html#comment-365</link>
		<author>Karl Schulz</author>
		<pubDate>Fri, 11 Jan 2008 21:50:28 +0000</pubDate>
		<guid>http://kreoton.net/more-secure-php-image-upload-class-tutorial-8.html#comment-365</guid>
		<description>$_SERVER['DOCUMENT_ROOT'].'/tnimg/'.$IM-&#62;tmp_image['name']

flaw: 'name' is user input
example: tmp_image['name'] = '../../../../etc/file'
solution: use basename()

Suggestions:
- finfo_file for file type validation (fileinfo extension)
- just getimagesize (reads header) for "all" images types
- pay attention to damn magic quotes in file names</description>
		<content:encoded><![CDATA[<p>$_SERVER[&#8217;DOCUMENT_ROOT&#8217;].&#8217;/tnimg/&#8217;.$IM-&gt;tmp_image[&#8217;name&#8217;]</p>
<p>flaw: &#8216;name&#8217; is user input<br />
example: tmp_image[&#8217;name&#8217;] = &#8216;../../../../etc/file&#8217;<br />
solution: use basename()</p>
<p>Suggestions:<br />
- finfo_file for file type validation (fileinfo extension)<br />
- just getimagesize (reads header) for &#8220;all&#8221; images types<br />
- pay attention to damn magic quotes in file names</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://kreoton.net/more-secure-php-image-upload-class-tutorial-8.html#comment-266</link>
		<author>Eric</author>
		<pubDate>Sat, 22 Dec 2007 20:57:33 +0000</pubDate>
		<guid>http://kreoton.net/more-secure-php-image-upload-class-tutorial-8.html#comment-266</guid>
		<description>The PHP Image Upload Script you have available to download appears to have a major bug within it, if possible email me and I will discuss it further.</description>
		<content:encoded><![CDATA[<p>The PHP Image Upload Script you have available to download appears to have a major bug within it, if possible email me and I will discuss it further.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
