FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Return False on download
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Return False on download [message #170548] Sun, 07 November 2010 17:17 Go to previous message
Brian Smither is currently offline  Brian Smither
Messages: 5
Registered: October 2010
Karma:
Junior Member
For the following code, can I get an opinion on what exactly the browser
will "do" or "receive" when the function returns false?


header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/octet-stream");
header("Content-Length: " . filesize($val));
$filename = explode("/",$val);
$parts = count($filename);
header("Content-Disposition: attachment; filename=".$filename[$parts-1]);

function readfile_chunked($filename) {
$chunksize = 1*(1024*1024); // how many bytes per chunk
$buffer = '';
$handle = fopen($filename, 'rb');
if($handle === false) { return false; }
while (!feof($handle)) {
$buffer = fread($handle, $chunksize);
print $buffer;
}
return fclose($handle);
}

readfile_chunked($val);
exit;
[Message index]
 
Read Message
Read Message
Previous Topic: checkbox own set and reload page
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 14 09:29:20 GMT 2024

Total time taken to generate the page: 0.05145 seconds