NYCPHP Meetup

NYPHP.org

[nycphp-talk] Does PHP have file size download limits? Best practice?

Dan Cech dcech at phpwerx.net
Mon May 16 14:22:37 EDT 2011


On 5/16/2011 2:16 PM, David Roth wrote:
> I want to offer users to be able to download a file from a PHP script. I
> seem to remember there were/are file size download limits with PHP?

You're probably thinking of the php ini settings that affect file 
uploads.  The issues you're likely to run into offering large downloads 
are indirect; memory limits can be a problem if you have to buffer the 
entire file into memory in PHP.

If you can stream it out to the client instead you can offer virtually 
unlimited file sizes.  You may need to extend the maximum execution time 
to avoid having your script cut off mid-download.

> Also
> what is the best practice for doing this with a PHP script? Thanks!

Best practice would include providing proper HTTP headers according to 
your situation, including Content-Disposition (with filename) and 
Content-Length so the browser's download progress meter will work properly.

Dan



More information about the talk mailing list