note 76701 added to function.header
| From: | rip at rip-hq dot net | Date: | Thu, 26 Jul 2007 21:06:57 +0000 |
| Subject: | note 76701 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128950@lists.php.net to get a copy of this message | ||
I've got a question. I have a file hosting site and I've run into a nice problem when
downloading files using the header function.
Here is the code I use for downloading the file
<?php
$file = "/path/to/file.ext";
header('Accept-Ranges: bytes');
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header('Content-type: ' . $fileDownloader->mime_get_type($file) . '\r\n'); //
Custom mime type function
header("Content-Length: ". filesize($file) . "\r\n");
header('Content-Disposition: attachment; filename="' . $v_name . '"');
header("Content-Transfer-Encoding: binary\n");
readfile($file);
?>
As far as downloads are concerned, everything download perfect. The only issue is that once the
download begins, that user can not do anything else on the website until the download is either
complete or canceled.
Any ideas?
----
Server IP: 208.69.120.35
Probable Submitter: 64.81.93.110
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- https://master.php.net/note/edit/76701
Del: integrated -- https://master.php.net/note/delete/76701/integrated
Del: useless -- https://master.php.net/note/delete/76701/useless
Del: bad code -- https://master.php.net/note/delete/76701/bad+code
Del: spam -- https://master.php.net/note/delete/76701/spam
Del: non-english -- https://master.php.net/note/delete/76701/non-english
Del: in docs -- https://master.php.net/note/delete/76701/in+docs
Del: other reasons-- https://master.php.net/note/delete/76701
Reject -- https://master.php.net/note/reject/76701
Search -- https://master.php.net/manage/user-notes.php