Output before end of execution of script
Posted: Sun Dec 04, 2005 5:48 pm
Hello,
This is the first time I have posted on this forum, but I have been searching for an answer to this problem for quite a bit of time and haven't found an answer that works. Anyhow, let me explain what I have created and what I need to add to it. I write a piece of software that and recently I was writing part of it that handles updates. Handling the updates was easy enough, but the problem I am now facing is: I send files, sometimes up to hundreds, between two servers using php. However, the process can sometimes take a few minutes. To a user it just appears like the website is loading the whole time, but in reality the website has been loaded for a while it is just uploading all those files. I have thought of two ways of fixing this.
1) Forking the script and having it do the uploads in the background so the user does not even see them.
2) Outputting after each file upload.
I would prefer to do #2, simply because then users can see what was uploaded and what wasn't. However, I can't figure out how to output before execution is finished on the script. I have a feeling that this can be accomplished with either headers, output buffering, or a combination of both. If anyone has any ideas on this I would greatly appreciated it.
Thanks!
This is the first time I have posted on this forum, but I have been searching for an answer to this problem for quite a bit of time and haven't found an answer that works. Anyhow, let me explain what I have created and what I need to add to it. I write a piece of software that and recently I was writing part of it that handles updates. Handling the updates was easy enough, but the problem I am now facing is: I send files, sometimes up to hundreds, between two servers using php. However, the process can sometimes take a few minutes. To a user it just appears like the website is loading the whole time, but in reality the website has been loaded for a while it is just uploading all those files. I have thought of two ways of fixing this.
1) Forking the script and having it do the uploads in the background so the user does not even see them.
2) Outputting after each file upload.
I would prefer to do #2, simply because then users can see what was uploaded and what wasn't. However, I can't figure out how to output before execution is finished on the script. I have a feeling that this can be accomplished with either headers, output buffering, or a combination of both. If anyone has any ideas on this I would greatly appreciated it.
Thanks!