Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3497316
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:21:20+00:00 2026-05-18T12:21:20+00:00

I have to implement a simple file download client in PHP capable of downloading

  • 0

I have to implement a simple file download client in PHP capable of downloading large files as well as resuming them.

Is there a way i can download large files (>700 MB) in PHP and still have my PHP memory limit to 128M ? I’m guessing this has to do with writing to a file pointer. Any clue on which file handling functions to use ? there are so many. I am guessing fopen, flock, (fwrite,fgets,fread), fclose. Or should i use cURL ?

How do i resume downloads which are broken ? Script execution timeout, user stopping script, remote server timeout etc. ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:21:21+00:00Added an answer on May 18, 2026 at 12:21 pm

    This should be possible using cURL by setting the CURLOPT_FILE and CURLOPT_RESUME_FROM options. I’m not sure whether cURL will overwrite the file or append to it, also whether it’ll buffer the file in memory or write it straight to disk. You may have to do some tests there.

    If you want more control over the whole process, you can use fsockopen to create a raw connection to the server you’re downloading from and write to and read from this connection using the normal fread and fwrite functions. You’d have to send (fwrite) the correct HTTP headers to the connection to initiate the transfer—most importantly the Range header for resuming transfers—and then read a few bytes using fread, then write those to a file and repeat until the transfer is complete.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented a simple file upload-download mechanism. When a user clicks a file
I have implement the simple TCP server and TCP client classes which can send
I have a page in my website that requires a simple file download link.
I am trying to implement a very simple file transfer client in python using
In general, is it a best practice to have simple POJO Java classes implement
I have to implement a middleware system for file sharing, and it has to
I have written a simple service that uploads & downloads XML files. I want
I am working to implement some simple preferences to an app I have and
I'm writing a simple little file-syncing daemon in python to implement a synchronised file
I need to implement a simple logging mechanism for my web application. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.