Which "progress upload plugin" is good?

Hello,

I want to implement one upload application and want to show the progress upload bar to the user. I am appreciate if you all could give me some idea about which plugin you think it is good for you.

Thanks Chamnap

I’m using SWFUpload with great success: http://swfupload.mammon.se/

Has upload progress (using client side technology, so no periodical hammering of your server) and has additional features such as upload queue (optional), file type filtering, multiple selection dialog, file size limiting (client side), …

Check out one of our public apps using it at http://demo.placid.be/albums/55;manage

If you need sessions for your uploads (user needs to be logged in to upload), this blog post will come in very handy: http://blog.inquirylabs.com/2006/12/09/getting-the-_session_id-from-swfupload/

Best regards

Peter De Berdt

Hi Peter,

What do you think about Mongrel Upload Progress (http:// mongrel.rubyforge.org/docs/upload_progress.html)?

Thanks Chamnap

Although I’m sure it’s a very good solution for other people on this list, my reasons not to use it are:

• Having to run another service (DRb) just for upload progress doesn’t really appeal me. SWFUpload doesn’t need another service to do what it does.

• The PeriodicalUpdater sends a status request to the server every three seconds, some of our apps are built around uploading files. Depending on the number of users, that would mean our server just gets hammered just for upload progress. SWFUpload gives constant feedback on the upload without one request to the server, it just measures the stream passed through the Flash file.

• I really needed client side filetype filtering and filesize limiting. It’s of no use to us that multigigabyte file is first uploaded just to let the user know he couldn’t do that. If it’s uploaded, it’s too late, as simple as that. Javascript doesn’t allow local file access, but Flash does have some limited ability that comes in handy.

• SWFUpload is just so dead easy to implement: put the files in your /public/javascripts/ folder, include the javascript in the pages where you want “ajax uploads”, and just HTML code and some javascript callbacks using prototype/scriptaculous.

As I said, some people really don’t want to use a Flash-based solution out of principle or because their userbase doesn’t have Flash installed, but our users for the most part are people that get all these funny little youtube movies from their coworkers and friends and watch them during their lunch break, i.e. Flash is installed everywhere :slight_smile: For us, SWFUpload is just the best solution to our problem.

Best regards

Peter De Berdt

I agree with your idea.

Chamnap

The site seems to be down at the moment. Does anybody happen to have the SWFUpload library available publicly where I could grab it?

Thanks and regards,

Andy Stewart

Site’s up for me

Best regards

Peter De Berdt

I'm trying to use SWFUpload but keep getting 302s returned when I upload a file.

I am picking up the session correctly as per the blog post mentioned above. I am able to read and store the files on the server side.

But instead of heeding my redirect at the end of my action, SWFUpload somehow throws a 302s and stops the redirect.

Nothing untoward shows up in my Rails log. Each action just completes with a 302.

I'd really like this to redirect as my action says.

Any help would be greatly appreciated.

Thanks and regards, Andy Stewart

Just to clarify: I know that Rails redirects with a 302 status code so that is working correctly. The question I'm asking is how to prevent SWFUpload from treating this as an error.

Thanks in advance,

Andy Stewart

I’m trying to use SWFUpload but keep getting 302s returned when I

upload a file.

I am picking up the session correctly as per the blog post mentioned

above. I am able to read and store the files on the server side.

This code needs to be in environment.rb

But instead of heeding my redirect at the end of my action, SWFUpload

somehow throws a 302s and stops the redirect.

Nothing untoward shows up in my Rails log. Each action just

completes with a 302.

I’d really like this to redirect as my action says.

Any help would be greatly appreciated.

This is my code (still using an older version of swfupload, but the newer version should be similar):

Application controller

before_filter :set_cookie_session

def set_cookie_session

@session_id = cookies[:_session_id]

end

View

		<script type="text/javascript">

			mmSWFUpload.init({

				upload_backend : "<%= url_for(:action => "upload_file", :id => @myrecord.id, :_session_id => @session_id)-%>",

				target : "SWFUpload",

				allowed_filesize : "40000",

				allowed_filetypes : "*.jpg;*.png;*.zip",

				upload_start_callback : 'uploadStart',

				upload_progress_callback : 'uploadProgress',

				upload_complete_callback : 'uploadComplete',

				upload_queue_complete_callback : 'uploadQueueComplete'

			});

		...

		     uploadQueueComplete = function() {

...

<%= remote_function(:url => {:action => :render_uploaded_files, :id => @myrecord.id}) -%>;

}

		</script>

Controller

def upload_file

store the file, then

render :nothing => true

end

The key point to understand here is to render nothing or just a status code at the end of the method. Don’t redirect. You need to handle the result by using the upload_complete_callback from SWFUpload (e.g. call a method through AJAX to render to file to the layout). The result code you send back at the end of the upload_file method let’s the Flash movie SWFUpload uses know if the file was uploaded successfully, it doesn’t interface with your HTML directly. Sending this result code back will cause the Flash movie to trigger the upload_queue_complete_callback, and then you’re free to do whatever you want again.

Best regards

Peter De Berdt

Thank you very much for that insight -- it's exactly what I needed. Everything now works perfectly.

Thanks too for the code snippets.

Regards, Andy Stewart