I'm writing an extension which needs to upload files to a web server. I have the file upload part working fine (I've based my JS code on http://lxr.mozilla.org/seamonkey/source ... on.cpp#593 ).
I'm using nsIProgressEventSink to track the file upload. When I upload a file, the 'progress' parameter passed to the onProgress listener goes from 0 up to the file size. However if I upload a second file straight away, the 'progress' parameter continues counting up from the file size of the previous upload (but the progressMax parameter is correct). If I wait a minute or so before uploading another file then the 'progress' parameter starts from 0 again.
I've based my progress listener code on this developer.mozilla.org article. I've put all the code into a single .js file that you can try it out using the 'Javascript Environment' from the Extension Developer Extension. Hopefully you'll see the same thing as I do.
I'd be really grateful if someone could take a look at the code and tell my why this is happening.
Tracking file upload with nsIProgressEventSink
-
- Posts: 80
- Joined: August 11th, 2003, 10:23 am
- Location: UK