Upload progress with Mongrel doesn't work in dev mode

I’ve not been able to get upload progress with Mongrel working after
following the instructions here:

"Mongrel::Uploads.check(params[:upload_id]) " always returns nil even
during a very large upload. Everything else in my test app is working
fine, the file uploads fine, just can’t get the progress from Mongrel.

I’m running in development mode (not using the cluster method yet)
uri “/”,
:handler => plugin(“/handlers/upload”, :path_info => ‘/files/
:in_front => true

My environment is:

Rails 1.2.2
Mongrel upload progress plugin: 0.2.1

I’d also like to know people’s opinions on if this is even realistic
with Mongrel for a production site. Might I run in to problems if
multiple people are uploading at the same time since in the production
cluster situation, a single process has to be responsible for all the
uploads so Its progress as described in that tutorial.?

I am considering using a Flash approach instead with the new
FileReference feature.

Many thanks

David N.

On 26 Feb 2007, at 16:07, David N. wrote:

I am considering using a Flash approach instead with the new
FileReference feature.

I would also recommend using a Flash-based approach, you’ll avoid
having to deal with things serverside and it always works. I’ve
implemented SWFUpload (http://swfupload.mammon.se/) for “AJAX upload
with progress feedback” and it works just great, once know a few
small things to look out for. It not only provides you with progress
feedback, but will also allow you to limit file size, file types and
multiple file selection, all client side. It needs Flash 8 installed,
but that shouldn’t really be a problem nowadays, where Flash is
pretty common.

If you would like access to one of my Rails apps using SWFUpload so
you can see how it works in a Rails environment, contact me offlist.

Best regards

Peter De Berdt

Hi David,

I just fought through this and got this working last week. I had the
same issue where it returned nil for a while. It was some work, but
well worth it because it’s portable to Flash and AJAX
implementations. Also, you can show upload progress not just to the
guy uploading the file, but to anyone who might be waiting to see it
(this was a need for us since we have a chat system).

Some things to check:

  1. Double check the URL you’re uploading to from the FileReference.
    It must have an upload_id parameter in it.
  2. Where are you querying for Mongrel::Uploads.check?
  3. Check for any specific routings in routes.rb mentioning your upload
    action, and try removing them
    these can sometimes mess up the upload_id syntax (this is the one
    that stumped me for a while)

Here’s a sample of the URL I uploaded to:

// The listener object listens for FileReference events.
var listener:Object = new Object();

   // This event gets called when the user selects a file

listener.onSelect = function(selectedFile:FileReference):Void {
// Once we get the resource back, we’ll do the upload
selectedFile.upload(me.url + “/file/flash_upload?upload_id=” +

   // Create a new file reference which we'll use to do the

var uploader:FileReference = new FileReference();

// Start the process by browsing for the file in question
uploader.browse([{description: “All Files”, extension: “.”}]);

Hope this helps,

Thanks for the suggestions

I decided to go with Flash only and that works great except that I
can’t get Flash’s POST upload request to maintain the session in
Rails, even when passing through the right session_id in the
querystring of the upload URL.



On Feb 26, 5:09 pm, “PeteDeLaurentis” [email protected]