views:

136

answers:

6

Can anyone suggest a good and easy way to include the file upload progress bar, while uploading a file. I know it would be a mix of javascript & php. Please suggest one

A: 

SWFUpload

SWFUpload is a JavaScript Library that wraps the Flash Player's upload function. It brings your uploads to the next level with Multiple File Selection, Upload Progress and Client-side File Size Checking.

Bob Fanger
Well... not really: It works differently from a normal form-based file upload. You can't just put it into a normal file upload form and show a progress bar, which I think the OP is looking for. (If not, SWFUpload is a great choice!)
Pekka
Rahul TS
the swf upload is great but I dont go so deep as you said it may not be usefull in this specific case of encodeing video file after uploading
Rahul TS
+1  A: 

I like uploadify. Its very easy to implement and does the job perfectly.

Iznogood
yes I like the uploadify and currently using it for showing the upload progress. Its a good and neat one. I am trying it another way so that I can simply do the job with less files and more control over the design as I am not so fit with the swf flash stuffs.Also I have a doubt whether I can do the video encoding while uploading the video files through uploadify with ffmpeg
Rahul TS
Sure you can. Once the file is on the server it changes nothing how it got there. And javascript solutions would have to be tested on internet explorer. Good luck with that. :)
Iznogood
thanks, have you had an idea of sample encoding technique other than ffmpeg to convert the video files into .flv .mp4 and .avi format. Cause the current hosting account of mine is not supporting the ffmpeg format
Rahul TS
NOthing except using something like esternal services that do this for you. Even store the videos. Amazon S3 comes to mind.
Iznogood
A: 

You'll have to check the size of the part of the file wich is allready on the Server, then get it on the Client per Ajax where you can paint the progress bar. (Remember to check the size of the hole Data before, to calculate the percantage ;-) )

Tokk
So... you have to upload the file in order to know its size, and then jump back in time to show the progress bar? :)
Pekka
right :-D No, you could read the filesize in the browser per JS bevore the upload...
Tokk
@Tokk that is not possible. There is no access to local files from JavaScript.
Pekka
A: 

http://valums.com/ajax-upload/

I chanced upon this recently and really liked it.

Alec Smart
thanks I'll check this to find whether it will work for me
Rahul TS
It doesn't seem to have a progress bar, though.
Pekka
The title says with Progress Bar. Am not sure though.
Alec Smart
A: 

I don't believe this is possible utilizing ajax. The only time you can get the complete file size is after upload and by then it's too late. '

If you utilize a flash-based uploader however, it is possible.

Angelo R.
A: 

all "ajaxy" looking solutions use an swf object to do the upload job. you can home-cook your progressbar if you have an op-code cacher like APC

Here is Martin Jansen blogging about Rasmus Lerdorf's simple upload code which in the end uses APC

http://martinjansen.com/2007/04/28/file-upload-progress-bars-with-php/

and a working example

kali