0xD34DB33F Posted December 8, 2011 Share Posted December 8, 2011 Hi ! I am currently trying to develop a PHP application in which my server downloads a file and the user can do the same almost simultaneously. I already think about the problem "If the user downloads fastly than the server...", but it's not a problem at this moment. To do so, I used the header and readfile functions of php. Here is my code : header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="'.$data['name'].'";'); header('Content-Transfer-Encoding: binary'); header('Content-Length: '.$data['size']); readfile($remoteFile); I must to use the Content-length header to set the proper size of the file and not the size that is downloaded when the user clicks on the link. However, after some seconds or minutes, download is stopped and I need to restart... If you think about a solution, even if it didn't use the header(); function, please tell me. Thank you in advance... Quote Link to comment https://forums.phpfreaks.com/topic/252739-downloads-and-headers/ Share on other sites More sharing options...
0xD34DB33F Posted December 8, 2011 Author Share Posted December 8, 2011 up ? Quote Link to comment https://forums.phpfreaks.com/topic/252739-downloads-and-headers/#findComment-1295937 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.