Created
April 19, 2010 07:13
-
-
Save aq1018/370812 to your computer and use it in GitHub Desktop.
SWFUpload session cookie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def post_params_json | |
post_params = {} | |
post_params['authenticity_token'] = CGI::escape(form_authenticity_token) | |
post_params[session_key.to_s] = CGI::escape(cookies[session_key]) | |
post_params.to_json | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionController::Base.session = { | |
:key => '_your_session', | |
:secret => 'your key' | |
} | |
ActionController::Dispatcher.middleware.use FlashSessionCookieMiddleware, ActionController::Base.session_options[:key] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$(".swfuploader").swfuploader({ | |
upload_url : "/images", | |
set : "MultiFile", | |
file_post_name : "image[attachment]", | |
post_param : <%= post_params_json %> | |
upload_success_handler : function(file, serverData, response){ | |
var data = eval("("+ serverData + ")"); | |
$(data.partial).hide().prependTo($(".images")).fadeIn(); | |
} | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment