• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1004
  • Last Modified:

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.
0
Shroder
Asked:
Shroder
  • 4
  • 4
1 Solution
 
pvginkelCommented:
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.
0
 
ShroderAuthor Commented:
http://bluga.net/projects/uploadProgressMeter/

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.
0
 
pvginkelCommented:
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.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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.
0
 
pvginkelCommented:
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.
0
 
ShroderAuthor Commented:
ahh. So that is where you have to recompile the php binary?

That also explains why I couldn't find the function.
0
 
pvginkelCommented:
Yep. More questions?
0
 
ShroderAuthor Commented:
Sorry for the delay. That is all. Thank you for your help!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now