Home »
Imported messages »
comp.lang.php »
Return False on download
Re: Return False on download [message #170550 is a reply to message #170548] |
Sun, 07 November 2010 19:23 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 11/7/2010 12:17 PM, Brian Smither wrote:
> 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;
>
>
Exactly what you sent - the headers and nothing else.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Goto Forum:
Current Time: Thu Nov 14 09:31:50 GMT 2024
Total time taken to generate the page: 0.06467 seconds