Reg file downloading

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sumeet
Forum Newbie
Posts: 15
Joined: Mon May 23, 2005 3:55 pm
Location: Hyderabad
Contact:

Reg file downloading

Post by sumeet »

I m facing a probs in allowing file downloads. The probs is i m able to download files of size <= 2Mb but not more than this .. The script i m using is

header("Content-Description: File Transfer");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=". "paper.pdf");

readfile($link);

where $link is path to file which i wanna download .. I m using apache server in linux .. any suggestions ??
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Normally file upload is set to 2 MB in the php.ini file as
upload_max_filesize = 2M

but I dont think there is a premade restriction for downloads unless there is an .htaccess file in that folder that rectricts.
sumeet
Forum Newbie
Posts: 15
Joined: Mon May 23, 2005 3:55 pm
Location: Hyderabad
Contact:

Post by sumeet »

anjanesh wrote:Normally file upload is set to 2 MB in the php.ini file as
upload_max_filesize = 2M

but I dont think there is a premade restriction for downloads unless there is an .htaccess file in that folder that rectricts.
The limit to upload in php.ini was raised to 15 MB by me long back .. and i dint made any changes by .htaccess .. any other option ??
Revan
Forum Commoner
Posts: 83
Joined: Fri Jul 02, 2004 12:37 am
Location: New Mexico, USA
Contact:

Post by Revan »

Perhaps Apache is timing out?
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Try adding binary transfer encoding and file size:

Code: Select all

header(&quote;Content-Transfer-Encoding: binary&quote;);
header(&quote;Content-Length: &quote;.filesize(&quote;paper.pdf&quote;));
Post Reply