<?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: File Downloader</title>
	<atom:link href="http://bayu.freelancer.web.id/2007/09/10/file-downloader/feed/" rel="self" type="application/rss+xml" />
	<link>http://bayu.freelancer.web.id/2007/09/10/file-downloader/</link>
	<description>Learn Programming, The Freelancer&#039;s Way</description>
	<lastBuildDate>Wed, 01 Sep 2010 16:13:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
	<item>
		<title>By: Arief Bayu Purwanto</title>
		<link>http://bayu.freelancer.web.id/2007/09/10/file-downloader/comment-page-1/#comment-11042</link>
		<dc:creator>Arief Bayu Purwanto</dc:creator>
		<pubDate>Mon, 10 Sep 2007 16:08:12 +0000</pubDate>
		<guid isPermaLink="false">http://bayu.freelancer.web.id/index.php/2007/09/10/file-downloader/#comment-11042</guid>
		<description>mumpung baru muncul.
eh...eh... ternyata bisa dibuat lebih simple, seperti ini:
[code lang=&quot;php&quot;]
&lt;?php
    function downloadFile($filepath, $filename = &#039;&#039;){
        header(&#039;Content-Type: application/octet-stream&#039;);
        header(&#039;Content-Length: &#039; . filesize($filepath));
        header(&#039;Content-Disposition: attachment; filename=&quot;&#039;.(trim($filename) == &#039;&#039;? basename($filepath) : $filename).&#039;&quot;&#039;);
        @readfile($filepath);
    }
?&gt;
[/code]
trus cara pakenya:
[code lang=&quot;php&quot;]
&lt;?php
    $fpath = &#039;/home/user/webuser/non_web_accessible_dir/file.pdf&#039;;
    
    //downloadFile($fpath);
    //     atau 
    downloadFile($fpath, &#039;nama_file_yang_baru.pdf&#039;);
?&gt;
[/code]
hihihihi, last minute hack :D</description>
		<content:encoded><![CDATA[<p>mumpung baru muncul.<br />
eh&#8230;eh&#8230; ternyata bisa dibuat lebih simple, seperti ini:</p>
<pre class="brush: php;">
&lt;?php
    function downloadFile($filepath, $filename = ''){
        header('Content-Type: application/octet-stream');
        header('Content-Length: ' . filesize($filepath));
        header('Content-Disposition: attachment; filename=&quot;'.(trim($filename) == ''? basename($filepath) : $filename).'&quot;');
        @readfile($filepath);
    }
?&gt;
</pre>
<p>trus cara pakenya:</p>
<pre class="brush: php;">
&lt;?php
    $fpath = '/home/user/webuser/non_web_accessible_dir/file.pdf';

    //downloadFile($fpath);
    //     atau
    downloadFile($fpath, 'nama_file_yang_baru.pdf');
?&gt;
</pre>
<p>hihihihi, last minute hack <img src='http://bayu.freelancer.web.id/smilies/yahoo_bigsmile.gif' alt='&#58;&#68;' class='wp-smiley' width='18' height='18' title='&#58;&#68;' /></p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)

Served from: bayu.freelancer.web.id @ 2010-09-06 07:47:14 -->