Jump to content

Recommended Posts

Hello,

 

I am working on a project that downloads large zip files from server, for small files the script works well and downlaod files successfully, but for larger files like currently we are trying to download a 922MB file it gives us this message (in firefox) and doesn't download any thing.

 

"

File not found

 

Firefox can't find the file at http://www.domainname.com/abc.zip

 

"

Script to download the file is as below:

 

"

$filename = "xyz.mp3;

 

header("Pragma: public");

header("Expires: 0");

header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

 

header("Content-Type: application/force-download");

header("Content-Type: application/octet-stream");

header("Content-Type: application/download");

 

header("Content-Disposition: attachment; filename=".basename($filename).";");

 

header("Content-Transfer-Encoding: binary");

header("Content-Length: ".filesize($filename));

 

if( !ini_get('safe_mode') )

set_time_limit(360000000);

 

readfile("$filename");

"

 

Please advise what can be issue, if its file size issue then how and where can we increase the limit to solve this issue.

 

pre-thanks,

Link to comment
https://forums.phpfreaks.com/topic/247634-large-file-download-issue/
Share on other sites

For large files use the function passthru()

 

<?php
$path = '/full/path/to/file/';
$filename = 'xyz.mp3';

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");
header("Content-Disposition: attachment; filename=".$filename.";");				
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($path.$filename));
passthru("cat \"$path.$filename\"");
exit();
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.