2

How can I create a file upload progress bar with PHP and jQuery? Please don't refer me to Flash stuff like Uploadify. I want to create my own.

4 Answers 4

4

Just store and update the progress in server side session and use repeated ajaxical calls from the client side on to obtain the current progress from the server side session until it gets 100%. Long story short, here's a clear tutorial how to do it with PHP and jQuery: How to build an ajax progress bar with jQuery and PHP.

Then the server side part, you need at least PHP 5.2 for this with the PECL Uploadprogress extension. You can find here a blog about it: PECL Uploadprogress example. This comment of jazfresh on php.net is also helpful.

Sign up to request clarification or add additional context in comments.

2 Comments

@Rubens: I knew I forgot something, I updated the answer. In Java/.NET this has been trivial for ages, but in PHP it wasn't supported for long until PECL Uploadprogress came last year.
Wonderful. This wasn't possible not long ago :)
0

If you don't want to use an already prebuilt one like swfupload you'll have to get your action-script-fu ready and use the external interface api to make it talk with jQuery.

Comments

0

Basically you'll need to control how much data is sent in some time span. As you don't control your browser data transfer, neither how your browser read data from your file, you can't do that with plain Javascript.

You'll need some 3rd party control, like Silverlight, Flash or Java applets. Using them you'll have granted that filesystem access, so you can control how to read your source file. So, to build your progress bar, you just need to make several HTTP calls to your server application sending your source file in small pieces.

Comments

-3

To get file(s) upload progress you should use Flash. A tutorial with more info can be found here. Note that this is using .NET though, not PHP.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.