Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>No. The reason it doesn't work is because Flex does not transmit the cookies when using FileReference#upload. A workaround (for Rails 2.3) is to insert a custom middleware handler for flash requests that takes arguments in the query string and adds them to the HTTP_COOKIE environment before it reaches Rails.</p> <pre><code>require 'rack/utils' class FlashSessionCookieMiddleware def initialize(app, session_key = '_session_id') @app = app @session_key = session_key end def call(env) if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/ params = ::Rack::Utils.parse_query(env['QUERY_STRING']) env['HTTP_COOKIE'] = [ @session_key, params[@session_key] ].join('=').freeze unless params[@session_key].nil? end @app.call(env) end end </code></pre> <p>Make sure the file is in your load path and add it to your session_store.rb:</p> <pre><code>ActionController::Dispatcher.middleware.use FlashSessionCookieMiddleware, ActionController::Base.session_options[:key] </code></pre> <p>Then you'll need to output the session key to a view somewhere and load it using ExternalInterface inside of Flex:</p> <pre><code>def upload_path_with_session_information session_key = ActionController::Base.session_options[:key] uploads_path(session_key =&gt; cookies[session_key], request_forgery_protection_token =&gt; form_authenticity_token) end </code></pre> <p>As you can see I have resource called uploads and I use the <code>upload_path_with_session_information</code> helper to give me a nice URL that when POSTED to from FLEX lets you keep your cookie store for everything else.</p> <p>I honestly don't remember where I found this information online, but I can't take the credit for it. Hope it makes sense for you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload