<?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: How To Force File Download With PHP</title>
	<atom:link href="http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/</link>
	<description>A blog about web development, software business, and WordPress</description>
	<lastBuildDate>Mon, 21 May 2012 06:20:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Dev &#124; Pearltrees</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-6/#comment-199619</link>
		<dc:creator>Dev &#124; Pearltrees</dc:creator>
		<pubDate>Tue, 17 Apr 2012 18:13:44 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-199619</guid>
		<description>[...] header( &#039;Pragma: private&#039; ); header( &quot;Expires: Mon, 26 Jul 1997 05:00:00 GMT&quot; ); header( &quot;Cache-control: private&quot; );  How To Force File Download With PHP &#124; W-Shadow.com [...]</description>
		<content:encoded><![CDATA[<p>[...] header( &#039;Pragma: private&#039; ); header( &quot;Expires: Mon, 26 Jul 1997 05:00:00 GMT&quot; ); header( &quot;Cache-control: private&quot; );  How To Force File Download With PHP | W-Shadow.com [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Web tools &#124; Pearltrees</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-6/#comment-198936</link>
		<dc:creator>Web tools &#124; Pearltrees</dc:creator>
		<pubDate>Tue, 20 Mar 2012 21:40:53 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-198936</guid>
		<description>[...] How To Force File Download With PHP &#124; W-Shadow.com header( &#039;Pragma: private&#039; ); [...]</description>
		<content:encoded><![CDATA[<p>[...] How To Force File Download With PHP | W-Shadow.com header( &#039;Pragma: private&#039; ); [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: just another addict</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-198307</link>
		<dc:creator>just another addict</dc:creator>
		<pubDate>Thu, 23 Feb 2012 19:43:56 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-198307</guid>
		<description>Thanks very much for this. You are a genius!!!</description>
		<content:encoded><![CDATA[<p>Thanks very much for this. You are a genius!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: swellendam accommodation</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-180174</link>
		<dc:creator>swellendam accommodation</dc:creator>
		<pubDate>Mon, 19 Sep 2011 16:37:36 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-180174</guid>
		<description>&lt;strong&gt;swellendam accommodation...&lt;/strong&gt;

[...]How To Force File Download With PHP &#124; W-Shadow.com[...]...</description>
		<content:encoded><![CDATA[<p><strong>swellendam accommodation&#8230;</strong></p>
<p>[...]How To Force File Download With PHP | W-Shadow.com[...]&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WuFe</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-176005</link>
		<dc:creator>WuFe</dc:creator>
		<pubDate>Tue, 06 Sep 2011 17:12:23 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-176005</guid>
		<description>Goosy, the cURL method to retrieve the file size doesn&#039;t work ever.
The best function to retrieve the size of a remote file is this:

function remotefilesize( $url ){
    $size = get_headers( $url, 1 );
    $size = $size[ &quot;Content-Length&quot; ];
    return $size;
}

Anyway thanks a lot for the snippet..</description>
		<content:encoded><![CDATA[<p>Goosy, the cURL method to retrieve the file size doesn&#8217;t work ever.<br />
The best function to retrieve the size of a remote file is this:</p>
<p>function remotefilesize( $url ){<br />
    $size = get_headers( $url, 1 );<br />
    $size = $size[ "Content-Length" ];<br />
    return $size;<br />
}</p>
<p>Anyway thanks a lot for the snippet..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: goosy</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-173157</link>
		<dc:creator>goosy</dc:creator>
		<pubDate>Tue, 23 Aug 2011 08:55:59 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-173157</guid>
		<description>Thanks a lot !!! Just more things for force download on cross -domain 
delte this line &quot;if(!is_readable($file)) die(&#039;File not found or inaccessible!&#039;);&quot; and for the file size use curl method like above 
// Create a curl connection
$chGetSize = curl_init();
 
// Set the url we&#039;re requesting
curl_setopt($chGetSize, CURLOPT_URL, &quot;http://www.example.com/file.exe&quot;);
 
// Set a valid user agent
curl_setopt($chGetSize, CURLOPT_USERAGENT, &quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11&quot;);
 
// Don&#039;t output any response directly to the browser
curl_setopt($chGetSize, CURLOPT_RETURNTRANSFER, true);
 
// Don&#039;t return the header (we&#039;ll use curl_getinfo();
curl_setopt($chGetSize, CURLOPT_HEADER, false);
 
// Don&#039;t download the body content
curl_setopt($chGetSize, CURLOPT_NOBODY, true);
 
// Run the curl functions to process the request
$chGetSizeStore = curl_exec($chGetSize);
$chGetSizeError = curl_error($chGetSize);
$chGetSizeInfo = curl_getinfo($chGetSize);
 
// Close the connection
curl_close($chGetSize);// Print the file size in bytes
 
$size=$chGetSizeInfo[&#039;download_content_length&#039;];

thx again !</description>
		<content:encoded><![CDATA[<p>Thanks a lot !!! Just more things for force download on cross -domain<br />
delte this line &#8220;if(!is_readable($file)) die(&#8216;File not found or inaccessible!&#8217;);&#8221; and for the file size use curl method like above<br />
// Create a curl connection<br />
$chGetSize = curl_init();</p>
<p>// Set the url we&#8217;re requesting<br />
curl_setopt($chGetSize, CURLOPT_URL, &#8220;http://www.example.com/file.exe&#8221;);</p>
<p>// Set a valid user agent<br />
curl_setopt($chGetSize, CURLOPT_USERAGENT, &#8220;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11&#8243;);</p>
<p>// Don&#8217;t output any response directly to the browser<br />
curl_setopt($chGetSize, CURLOPT_RETURNTRANSFER, true);</p>
<p>// Don&#8217;t return the header (we&#8217;ll use curl_getinfo();<br />
curl_setopt($chGetSize, CURLOPT_HEADER, false);</p>
<p>// Don&#8217;t download the body content<br />
curl_setopt($chGetSize, CURLOPT_NOBODY, true);</p>
<p>// Run the curl functions to process the request<br />
$chGetSizeStore = curl_exec($chGetSize);<br />
$chGetSizeError = curl_error($chGetSize);<br />
$chGetSizeInfo = curl_getinfo($chGetSize);</p>
<p>// Close the connection<br />
curl_close($chGetSize);// Print the file size in bytes</p>
<p>$size=$chGetSizeInfo['download_content_length'];</p>
<p>thx again !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nlayno</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-169760</link>
		<dc:creator>nlayno</dc:creator>
		<pubDate>Wed, 25 May 2011 07:41:04 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-169760</guid>
		<description>how to use this script ?


foredownload.php?file=http://--.zip &lt;- like that?</description>
		<content:encoded><![CDATA[<p>how to use this script ?</p>
<p>foredownload.php?file=http://&#8211;.zip &lt;- like that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vhortex</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-168927</link>
		<dc:creator>vhortex</dc:creator>
		<pubDate>Sun, 24 Apr 2011 14:44:22 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-168927</guid>
		<description>@pk1001100011

You don&#039;t need to put full filters on this function, the filters should be added somewhere on your code to prevent bloating your functions.

Provided code is only an example on how to do things.  

I read your website and this is different from the script that you reviewed. 
safe_mode can only be turned on by system admins and not ordinary hosted users unless you have a VPS account or a dedicated account. This function is turned on 97% of the time on shared hosting.

open_basedir is enabled on secured servers and there is no way to activate it on shared hosting accounts. This will cause trouble on account creations due to the restrictions that needs to be applied per account/domain.

open_basedir rule on applies to 1 and 1 domain or subdomain causing errors on the next subdomains that will be created unless you add a new open_basedir  for that subdomain.</description>
		<content:encoded><![CDATA[<p>@pk1001100011</p>
<p>You don&#8217;t need to put full filters on this function, the filters should be added somewhere on your code to prevent bloating your functions.</p>
<p>Provided code is only an example on how to do things.  </p>
<p>I read your website and this is different from the script that you reviewed.<br />
safe_mode can only be turned on by system admins and not ordinary hosted users unless you have a VPS account or a dedicated account. This function is turned on 97% of the time on shared hosting.</p>
<p>open_basedir is enabled on secured servers and there is no way to activate it on shared hosting accounts. This will cause trouble on account creations due to the restrictions that needs to be applied per account/domain.</p>
<p>open_basedir rule on applies to 1 and 1 domain or subdomain causing errors on the next subdomains that will be created unless you add a new open_basedir  for that subdomain.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flor</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-168795</link>
		<dc:creator>Flor</dc:creator>
		<pubDate>Sat, 16 Apr 2011 20:40:23 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-168795</guid>
		<description>amm i don&#039;t know why but when the window to save the file opens  the file is downloaded like this  &quot;-myFile.pdf-&quot;, i mean the extension is changed for .pdf-  so it downloads corrupted or imposible to open any idea why this happens???</description>
		<content:encoded><![CDATA[<p>amm i don&#8217;t know why but when the window to save the file opens  the file is downloaded like this  &#8220;-myFile.pdf-&#8221;, i mean the extension is changed for .pdf-  so it downloads corrupted or imposible to open any idea why this happens???</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JavaGenious</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-147805</link>
		<dc:creator>JavaGenious</dc:creator>
		<pubDate>Mon, 20 Dec 2010 10:57:44 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-147805</guid>
		<description>Thanks for the info. Can you also provide an example of use for this method?</description>
		<content:encoded><![CDATA[<p>Thanks for the info. Can you also provide an example of use for this method?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

