Jump to content

using file_get_contents - is there a way to output progress


imran0

Recommended Posts

  • 4 years later...

This post has over 1,000 views and no one has responded. I would assume that it is not possible - at least not with file_get_contents(). You would likely have to build some process to get the size of the file, then get chunks of the file one at a time so you can calculate the percentage complete. Of course, you can't do this at all with a single PHP script. You have to implement AJAX. A PHP script completes ALL the execution and then returns the result to the page.

Pretty sure you could do it with cURL and the CURLOPT_PROGRESSFUNCTION callback or the CURLOPT_WRITEFUNCTION callback

 

Good call. Here's a forum post with a supposed working example: http://stackoverflow.com/questions/1939029/curl-download-progress-in-php-not-working

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.