Strange problem when downloading file from MySql DB
Posted: Sat Nov 01, 2008 8:02 am
Hello everyone, i wonder if anyone has a clue to solve following situation:
- when i download certain (zip) file by download manager, its size is exactly the same as original file , these files are identical
- when i download the same file by browser (no matter of what...IE,Firefox,Opera..), download file is incomplete (a few bytes missing so zip file is ocrrupted)
I found out that if header content-length is NOT used, then downloaded file is complete in both downlad managers and internet browsers, however without showing filesize and estimation download time.
Is there any way how to fix that?
- when i download certain (zip) file by download manager, its size is exactly the same as original file , these files are identical
- when i download the same file by browser (no matter of what...IE,Firefox,Opera..), download file is incomplete (a few bytes missing so zip file is ocrrupted)
I found out that if header content-length is NOT used, then downloaded file is complete in both downlad managers and internet browsers, however without showing filesize and estimation download time.
Is there any way how to fix that?
Code: Select all
$name = utf8_decode($file->taskfile_name);
$name = str_replace(' ','_',$name);
$type = "application/octet-stream";
// $type = "application/zip";
$size = $file->taskfile_size;
$content = $file->taskfile_content;
ob_clean(); //veeery important!! without that some empty lines will be added before output...
//header("Content-length: $size ");
header("Content-type: $type ");
header("Content-Description: VSElink team file");
header("Content-Disposition: attachment; filename=$name");
echo $content;
exit;