2 thoughts on “Download large files in PHP

  1. Rodrigo says:

    Hi, this code works like a charm, but after download a 11GB file, it warns me the file is corrupted.
    I tested the same file before upload to server, and it’s totally fine.
    Do you have any idea how to solve it?
    Thanks in advance.

  2. Tofeeq says:

    Have you tested it with a smaller file on your server?
    Here are steps to test.
    1. Test it with smaller file if that is also corrupt then download that file using ftp and see if that is fine. If file downloaded by ftp is also corrupt that means there is something wrong at file uploading.
    2. If the file downloaded by ftp seems fine then there might be spaces in download script, you can use ob_end_clean to clean up buffer before starting download.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s