Reputation: 1133
I wrote a download script in PHP as specified below, my script is downloading the files correctly, but I am feeling that the browser(chrome) progress bar is not getting updated properly in regular intervals.
My file is of size 320MB, while downloading that file the progress is getting updated randomly as "11MB, 76MB, 200Mb & 320MB" or "70MB & 320MB" etc.
In most of the sites download progress update is happening in constant chunks like after every MB, so I want to know how we can control the progress update intervals, may be by sending some extra headers or something else.
I want to improve the user experience by updating the progress in constant intervals, so anybody please help me to handle this situation in a proper way.
// HTTP Headers for ZIP File Downloads // http://perishablepress.com/press/2010/11/17/http-headers-file-downloads/ // file variables $filename = "Movie Tunes.zip"; $filepath = "files/"; // http headers for zip downloads header("Pragma: public"); header("Expires: 0"); header("Cache-Control: public,must-revalidate, post-check=0, pre-check=0"); header("Content-Description: File Transfer"); // MIME header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"".$filename."\""); header("Content-Transfer-Encoding: binary"); // MIME header("Content-Length: ".filesize($filepath.$filename)); ob_end_flush(); @readfile($filepath.$filename);
Thanks,
Siva
Upvotes: 1
Views: 989
Reputation: 522016
No, you cannot influence when/how the browser updates its download progress bar.
Upvotes: 0