views:

12

answers:

0

I got uploadify to work properly with a model that I have without any authentication. The problem is, a user needs to be authenticated before s/he can upload a file. When I enable the before filter, the file doesn't get uploaded.

before_filter :authenticate

def authenticate
  authenticate_or_request_with_http_basic do |name, password|
    name == "foo" && password == "bar"
    true
  end
end

With this enabled. The upload fails. Here's what I see in my development log:

Filter chain halted as [:authenticate] rendered_or_redirected.
Completed in 2ms (View: 1, DB: 0) | 401 Unauthorized

This only happens with the flash upload, not with a regular for download.

Any ideas?

Thanks!


UPDATE: Got around this by integrating session based authentication with authlogic instead. Don't love that solution but it works around the problem. Any ideas how to solve this specific problem would still be appreciated, though.