# Upload progress with Mongrel doesn't work in dev mode

**URL:** <https://www.ruby-forum.com/t/upload-progress-with-mongrel-doesnt-work-in-dev-mode/86865>\
**Category:** Rails\
**Created:** [February 26, 2007, 4:08pm UTC](https://www.ruby-forum.com/t/upload-progress-with-mongrel-doesnt-work-in-dev-mode/86865 "2007-02-26T16:08:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vanight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a698b9/32.png) [@vanight](https://www.ruby-forum.com/u/vanight)\
**Post date:** [February 26, 2007, 4:08pm UTC](https://www.ruby-forum.com/t/upload-progress-with-mongrel-doesnt-work-in-dev-mode/86865/1 "2007-02-26T16:08:57Z")

</div>

I’ve not been able to get upload progress with Mongrel working after  
following the instructions here:  
[http://mongrel.rubyforge.org/docs/upload\_progress.html](http://mongrel.rubyforge.org/docs/upload_progress.html)

"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/  
upload’),  
:in\_front =\> true

My environment is:

OS X  
Rails 1.2.2  
Mongrel 0.3.13.3  
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.

---

<div class="post-metadata">

**Author:** ![vanight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a698b9/32.png) [@vanight](https://www.ruby-forum.com/u/vanight)\
**Post date:** [February 26, 2007, 4:20pm UTC](https://www.ruby-forum.com/t/upload-progress-with-mongrel-doesnt-work-in-dev-mode/86865/2 "2007-02-26T16:20:00Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![vanight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a698b9/32.png) [@vanight](https://www.ruby-forum.com/u/vanight)\
**Post date:** [February 26, 2007, 6:10pm UTC](https://www.ruby-forum.com/t/upload-progress-with-mongrel-doesnt-work-in-dev-mode/86865/3 "2007-02-26T18:10:25Z")

</div>

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=” +  
resource.id.toString());  
}

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

```

uploading  
var uploader:FileReference = new FileReference();  
uploader.addListener(listener);

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

Hope this helps,  
Pete

---

<div class="post-metadata">

**Author:** ![vanight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a698b9/32.png) [@vanight](https://www.ruby-forum.com/u/vanight)\
**Post date:** [March 12, 2007, 1:03pm UTC](https://www.ruby-forum.com/t/upload-progress-with-mongrel-doesnt-work-in-dev-mode/86865/4 "2007-03-12T13:03:19Z")

</div>

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.

[http://groups.google.com/group/rubyonrails-talk/browse\_thread/thread/3416d885ecf2c59d](http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/3416d885ecf2c59d)

David

On Feb 26, 5:09 pm, “PeteDeLaurentis” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
