AJAX - Upload Monitoring

I found a script that actually monitors an upload, and I was trying to figure out how it works. Unfortunetly I can't find the function that collects the statistics in the source (I can just see it being called). So I'm hoping someone here can shed some light on how to do an upload progress bar with ajax.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If this is the system I think you're talking about; if I remember correctly I dropped that because it required recompilation of PHP or Apache (don't remember which). It's quite complicated to use this.

Just maybe though you'd like to know.

On the other hand; if you'd like an answer on your question, please post a reference or code.
ShroderAuthor Commented:

That is where I saw the example, and got the code from.

I thought it would probably be complicated, so for right now I'm just wanting to get an understanding of how it is done. I was hoping of figuring that out by looking at the function I mentioned before.
I believe that how this works is that the pach adds the function upload_progress_meter_get_info. This function depends on the hidden variable UPLOAD_IDENTIFIER that was set to a random value when the upload form submits. That random value can then be used to retrieve data about the upload.

What you have to understand is that this works parallel. In other words: while the form is uploading, you call a secondary PHP page every second and call the function upload_progress_meter_get_info to ask how far the upload is. In reality, you open two HTTP connections, one of which is uploading the files while the other is used to get statistics.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

ShroderAuthor Commented:
The part that has me stumped is how the second php page/script can keep track of the upload progress. Is it taking the size of the tmp file on the server? If so is the first php script (that the file is being uploaded to) set to upload the file to some place other then tmp?

Thanks for your help so far.
If I understand this correctly, the patch ties into the PHP function that receives POSTS. In a loop there it updates a set of statistics in memory. When you call the upload_progress_meter_get_info function it gets these statistics from memory.

It's all done in C code in the PHP binary.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ShroderAuthor Commented:
ahh. So that is where you have to recompile the php binary?

That also explains why I couldn't find the function.
Yep. More questions?
ShroderAuthor Commented:
Sorry for the delay. That is all. Thank you for your help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.