<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Code The World — File download with speed limit]]></title>
		<link>https://codetheworld.com/viewtopic.php?id=34</link>
		<atom:link href="https://codetheworld.com/extern.php?action=feed&amp;tid=34&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in File download with speed limit.]]></description>
		<lastBuildDate>Sun, 15 Jun 2008 11:47:01 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: File download with speed limit]]></title>
			<link>https://codetheworld.com/viewtopic.php?pid=124#p124</link>
			<description><![CDATA[<p>Yeh that would be cool</p>]]></description>
			<author><![CDATA[null@example.com (69)]]></author>
			<pubDate>Sun, 15 Jun 2008 11:47:01 +0000</pubDate>
			<guid>https://codetheworld.com/viewtopic.php?pid=124#p124</guid>
		</item>
		<item>
			<title><![CDATA[Re: File download with speed limit]]></title>
			<link>https://codetheworld.com/viewtopic.php?pid=118#p118</link>
			<description><![CDATA[<p>Nice post, but I was wondering if you can show us how to limit variable download, like between 20,5 kb and 40,00 kb?</p>]]></description>
			<author><![CDATA[null@example.com (Sancho Panssa)]]></author>
			<pubDate>Sun, 15 Jun 2008 10:47:15 +0000</pubDate>
			<guid>https://codetheworld.com/viewtopic.php?pid=118#p118</guid>
		</item>
		<item>
			<title><![CDATA[File download with speed limit]]></title>
			<link>https://codetheworld.com/viewtopic.php?pid=45#p45</link>
			<description><![CDATA[<p>This snippet shows you how to limit the download rate of a file download. <br /></p><div class="codebox"><pre><code>// local file that should be send to the client
$local_file = &#039;test-file.zip&#039;;
// filename that the user gets as default
$download_file = &#039;your-download-name.zip&#039;;
 
// set the download rate limit (=&gt; 20,5 kb/s)
$download_rate = 20.5; 
if(file_exists($local_file) &amp;&amp; is_file($local_file)) {
    // send headers
    header(&#039;Cache-control: private&#039;);
    header(&#039;Content-Type: application/octet-stream&#039;); 
    header(&#039;Content-Length: &#039;.filesize($local_file));
    header(&#039;Content-Disposition: filename=&#039;.$download_file);
 
    // flush content
    flush();    
    // open file stream
    $file = fopen($local_file, &quot;r&quot;);    
    while(!feof($file)) {
 
        // send the current file part to the browser
        print fread($file, round($download_rate * 1024));    
 
        // flush the content to the browser
        flush();
 
        // sleep one second
        sleep(1);    
    }    
 
    // close file stream
    fclose($file);}
else {
    die(&#039;Error: The file &#039;.$local_file.&#039; does not exist!&#039;);
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Rockers00)]]></author>
			<pubDate>Sun, 15 Jun 2008 03:48:59 +0000</pubDate>
			<guid>https://codetheworld.com/viewtopic.php?pid=45#p45</guid>
		</item>
	</channel>
</rss>
