Hello every, I'm new here and I know i only have one post but I promise to stay active...
Would anyone know a good code for a progress bar that is positioned in the center of an image every time it is used... I also don't want a set number of frames I want it to correctly say the progress %...
Hope that isn't to much to ask... I've tried google but didn't really get anywhere...
It's not easy. It means you need a server side component that is capable of measuring the progress. Many of the standard file uploaders don't have that capability.
The "trick" to it is to use AJAX to *get* the percentage from the web server.
Now, in the meantime the web server, on some other thread, is doing the actual upload. So the uploader has to "report" the percentage cross-thread to the AJAX responder.
One possible way to do this:
-- Your HTML page with the <input type=file> also has a HIDDEN form field with a value created via JS. The value is a random number--a GUID would be ideal, but make it at least a 32 bit random number (or maybe use a random string of characters??).
-- The uploader gets the info about the file being uploaded *AND* that random number/string.
-- As it is uploading the file, it periodically reports its progress (as a percentage) into a database (or, in some systems, such as ASP/ASP.NET, into an "Application variable") using that random number/string as the "key" for the data (so that multiple users can be uploading at the same time).
-- Your web page uses JS AJAX coding to hit the web server, as noted above, every few seconds and asks for the current percentage. You must display that percentage via a "popup" window or similar device, as the underlying form--doing the uploading--won't be "active".
-- A slight improvement on the above is to put the <FORM> into an <IFRAME> on the web page, so that the uploading is taking place independently of the web page and then the progress bar can be just a <div> on the main page.
If all this seems complicated, it is. If you don't have the means of creating your own file uploader, you are dependent on somebody else's uploader component having the needed progress monitoring builtin.
What language/system are you coding in??? PHP? ASP? What? I know of a commercial product for ASP, not too expensive. No experience doing this with PHP, though I'm 98% sure that the standard $_FILES method in PHP doesn't have this feature, so you'd have to find a way to do it yourself, most likely.
And by the by, because this is so very difficult, you see *most* web sites displaying "dummy" progress bars...basically just animate GIFs the look like progress bars but that don't really measure anything.