<?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: Detecting file size overflow in PHP</title>
	<atom:link href="http://andrewcurioso.com/2010/06/detecting-file-size-overflow-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://andrewcurioso.com/2010/06/detecting-file-size-overflow-in-php/</link>
	<description>Tech, Social Media, PHP, Opinions</description>
	<lastBuildDate>Wed, 16 May 2012 00:03:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: file upload to large, $_POST/$_FILE empty so cant throw error - Bizzteams</title>
		<link>http://andrewcurioso.com/2010/06/detecting-file-size-overflow-in-php/comment-page-1/#comment-32298</link>
		<dc:creator>file upload to large, $_POST/$_FILE empty so cant throw error - Bizzteams</dc:creator>
		<pubDate>Tue, 03 Apr 2012 18:30:13 +0000</pubDate>
		<guid isPermaLink="false">http://andrewcurioso.com/?p=232#comment-32298</guid>
		<description>[...] 0 Times in 0 Posts           For a solution that may work for you, see Detecting upload file size overflow in PHP &#124; Andrew&#039;s Tech Musings           Reply With [...]</description>
		<content:encoded><![CDATA[<p>[...] 0 Times in 0 Posts           For a solution that may work for you, see Detecting upload file size overflow in PHP | Andrew&#039;s Tech Musings           Reply With [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Curioso</title>
		<link>http://andrewcurioso.com/2010/06/detecting-file-size-overflow-in-php/comment-page-1/#comment-779</link>
		<dc:creator>Andrew Curioso</dc:creator>
		<pubDate>Thu, 21 Oct 2010 02:49:18 +0000</pubDate>
		<guid isPermaLink="false">http://andrewcurioso.com/?p=232#comment-779</guid>
		<description>Hi huarong, this post deals explicitly with the error that occurs when post_max_size is exceeded (which is difficult to detect because it wipes out the $_POST and $_FILE arrays).

When upload_max_filesize is exceeded it is actually treated as a normal upload error. So you can detect it by checking $_FILES[&#039;form_field_name&#039;][&#039;error&#039;] value after the upload and comparing it to UPLOAD_ERR_INI_SIZE. And yes, you should be checking this as well. See also: http://php.net/manual/en/features.file-upload.errors.php</description>
		<content:encoded><![CDATA[<p>Hi huarong, this post deals explicitly with the error that occurs when post_max_size is exceeded (which is difficult to detect because it wipes out the $_POST and $_FILE arrays).</p>
<p>When upload_max_filesize is exceeded it is actually treated as a normal upload error. So you can detect it by checking $_FILES['form_field_name']['error'] value after the upload and comparing it to UPLOAD_ERR_INI_SIZE. And yes, you should be checking this as well. See also: <a href="http://php.net/manual/en/features.file-upload.errors.php" rel="nofollow">http://php.net/manual/en/features.file-upload.errors.php</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: huarong</title>
		<link>http://andrewcurioso.com/2010/06/detecting-file-size-overflow-in-php/comment-page-1/#comment-775</link>
		<dc:creator>huarong</dc:creator>
		<pubDate>Thu, 21 Oct 2010 01:37:49 +0000</pubDate>
		<guid isPermaLink="false">http://andrewcurioso.com/?p=232#comment-775</guid>
		<description>Should I also check  &quot;upload_max_filesize&quot;  in php.ini?</description>
		<content:encoded><![CDATA[<p>Should I also check  &#8220;upload_max_filesize&#8221;  in php.ini?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Curioso</title>
		<link>http://andrewcurioso.com/2010/06/detecting-file-size-overflow-in-php/comment-page-1/#comment-441</link>
		<dc:creator>Andrew Curioso</dc:creator>
		<pubDate>Fri, 16 Jul 2010 14:22:52 +0000</pubDate>
		<guid isPermaLink="false">http://andrewcurioso.com/?p=232#comment-441</guid>
		<description>Hi okjiko,

Because we are first checking to see if REQUEST_METHOD is POST: the CONTENT_LENGTH value should always be set.

However, it is up to the web server to set CONTENT_LENGTH and it is notable that old versions of Apache (and possible other web servers) do not set it. For these servers, the code in this article will not work (that code in the previous comment will produce a false positive) and it may be a good idea to fall back to the &quot;processed=1&quot; method mentioned in the PHP documentation for those browsers.</description>
		<content:encoded><![CDATA[<p>Hi okjiko,</p>
<p>Because we are first checking to see if REQUEST_METHOD is POST: the CONTENT_LENGTH value should always be set.</p>
<p>However, it is up to the web server to set CONTENT_LENGTH and it is notable that old versions of Apache (and possible other web servers) do not set it. For these servers, the code in this article will not work (that code in the previous comment will produce a false positive) and it may be a good idea to fall back to the &#8220;processed=1&#8243; method mentioned in the PHP documentation for those browsers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: okjiko</title>
		<link>http://andrewcurioso.com/2010/06/detecting-file-size-overflow-in-php/comment-page-1/#comment-439</link>
		<dc:creator>okjiko</dc:creator>
		<pubDate>Fri, 16 Jul 2010 09:42:51 +0000</pubDate>
		<guid isPermaLink="false">http://andrewcurioso.com/?p=232#comment-439</guid>
		<description>I may use the condition in a wrong way, but as far as I am concerned, I&#039;ve added  &amp;&amp; isset($_SERVER[&#039;CONTENT_LENGTH&#039;]) to the condition :

if (
 $_SERVER[&#039;REQUEST_METHOD&#039;] == &#039;POST&#039;
 &amp;&amp; empty($_POST)
 &amp;&amp; empty($_FILES)
 &amp;&amp; isset($_SERVER[&#039;CONTENT_LENGTH&#039;])//here
 &amp;&amp; $_SERVER[&#039;CONTENT_LENGTH&#039;] &gt; 0 )

because the index CONTENT_LENGTH doesn&#039;t exist when the page is loaded in the first place.

Hope that helps</description>
		<content:encoded><![CDATA[<p>I may use the condition in a wrong way, but as far as I am concerned, I&#8217;ve added  &amp;&amp; isset($_SERVER['CONTENT_LENGTH']) to the condition :</p>
<p>if (<br />
 $_SERVER['REQUEST_METHOD'] == &#8216;POST&#8217;<br />
 &amp;&amp; empty($_POST)<br />
 &amp;&amp; empty($_FILES)<br />
 &amp;&amp; isset($_SERVER['CONTENT_LENGTH'])//here<br />
 &amp;&amp; $_SERVER['CONTENT_LENGTH'] &gt; 0 )</p>
<p>because the index CONTENT_LENGTH doesn&#8217;t exist when the page is loaded in the first place.</p>
<p>Hope that helps</p>
]]></content:encoded>
	</item>
</channel>
</rss>

