Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View _swfupload_form.html.erb
1 2 3 4 5 6
var swfup = new SWFUpload({
post_params : {
authenticity_token : '<%= u form_authenticity_token %>'
session: '<%= u request.env['rack.request.cookie_hash'].try(:[], Rails.application.config.session_options[:key]) %>'
}
});
View _swfupload_form.html.erb
1
config.middleware.insert_before ActionDispatch::Session::CookieStore, Rack::FlashSession
View _swfupload_form.html.erb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
require 'rack/utils'
 
module Rack
class FlashSession
 
def initialize(app, session_key = Rails.application.config.session_options[:key])
@app = app
@session_key = session_key
end
 
def call(env)
if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
req = Rack::Request.new(env)
session_data = req.params['session']
if session_data.blank?
log("error, env = #{env.inspect}")
else
env['HTTP_COOKIE'] = [@session_key, session_data].join('=').freeze
env['rack.request.query_hash'].delete('session')
env['rack.request.form_hash'].delete('session')
end
end
@app.call(env)
end
 
 
def log(message)
RAILS_DEFAULT_LOGGER.info(message)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.