Edit report at https://bugs.php.net/bug.php?id=43306&edit=1
ID: 43306
Comment by: hoangdangal at yahoo dot com
Reported by: d dot tas40 at chello dot nl
Summary: File Download Problem.
Status: No Feedback
Type: Bug
Package: Scripting Engine problem
Operating System: Windows XP
PHP Version: 5.2.5
Block user comment: N
Private report: N
New Comment:
let try this , i think it's ok
$file = @fopen($download_location,"rb");
if($fopen != NULL)
{
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: application/force-download",FALSE);
header("Content-Type: application/x-zip-compressed",FALSE);
header("Content-Type: application/download", FALSE);
header("Content-Disposition: attachment; filename=\"$this->FileName\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($download_location) + 100);
fpassthru($fopen);
fclose($fopen);
exit();
}
Previous Comments:
------------------------------------------------------------------------
[2009-07-02 12:03:44] manish at sakshiinfosys dot com
Hello,
I have created Mobile Software Secured download website.
When user click on download link that time opening box to Download file.
When Download Click on 'OK' button that time Succesfully downloaded after
Deleted that file and directory.
But, When Download Click on 'Cancel' Button that time also Deleted that file
and directory. Actually Click on 'Cancel' button and user not Downloaded.
Please i have need to help to Why we know file downloaded Successfully or not.
If you can not understand my problem than aslo reply me.
Thanks & Regards
Manish Bhuva
------------------------------------------------------------------------
[2009-05-06 18:56:54] fali68 at yahoo dot com
I have the same issue with PHP 4.449 and 4.1.2.0 mysql. and worked fine with
pervious version. can somone shed some light on this?
here is the code I'm using
mysql_select_db($database_tred, $conn);
$query = sprintf("SELECT * FROM Files WHERE Files.FileID = %s",
$TID_Recordset1);
$result = MYSQL_QUERY($query, $tred)or die(mysql_error());
$data = MYSQL_RESULT($result,0,"filename");
$type = MYSQL_RESULT($result,0,"filetype");
$filesize = MYSQL_RESULT($result,0,"filesize");
$file = MYSQL_RESULT($result,0,"bin_data");
if($result) {
header("Content-Tranfer-Encoding: binary");
header("Content-Disposition: attachment; filename= $data");
header("Content-length: $filesize");
header("Content-Description: PHP Generated Data");
print ($file);
------------------------------------------------------------------------
[2009-04-03 04:30:10] marcell at equylybra dot com
Also having issues using the same script. I get no errors when downloading
files with sizes below 20Mb.
>From 20Mb files are perfectly downloaded via FTP but are saved with a
>corrupted file size (0Kb) when downloaded via PHP. Tryed the solution proposed
>by "webmaster at anpera dot net" too but I had no success.
Tryed without Content-Lenght header with no effect. Also tryed with different
Content-Types (e.g.
'application/octet-stream','application/force-download','application/zip').
I am on PHP 5.2.8 with Apache 2.2.11 under Linux
------------------------------------------------------------------------
[2008-12-24 18:31:39] jon at jonraivala dot com
Using strlen of the blob instead of filesize in the header works for me.
Example -
header("Content-Length: ".strlen($blob_data));
Hope this helps someone.
------------------------------------------------------------------------
[2008-10-23 09:54:32] arasan at mahiti dot org
I've used this code but the download rate is very slow compared to ordinary
download. whether there is any way to overcome this?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=43306
--
Edit this bug report at https://bugs.php.net/bug.php?id=43306&edit=1