Skip to content

Instantly share code, notes, and snippets.

@m3talsmith
Created September 23, 2010 21:32
Show Gist options
  • Save m3talsmith/594412 to your computer and use it in GitHub Desktop.
Save m3talsmith/594412 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
$('#report_upload').uploadify({
'uploader' : '/uploadify.swf',
'script': '<%= url_for(:action => :create) %>',
'cancelImg' : '/images/cancel.png',
'auto' : false,
'fileDataName' : 'report[upload]',
'onComplete' : function() {window.location = "<%= users_path %>"},
'scriptData' : {
'report[upload_type]' : function() {$('#report_upload_type').val()}(),
'report[client_id]' : $('#report_client_id').val(),
'<%= session_key_name %>' : encodeURIComponent('<%= u cookies[session_key_name] %>'),
'authenticity_token' : encodeURIComponent('<%= u form_authenticity_token %>')}
});
$("#report_upload_type").change(function(){
$('#report_upload').uploadifySettings('scriptData', {
'report[upload_type]' : function() {$('#report_upload_type option:selected').val()}(),
'report[client_id]' : $('#report_client_id').val(),
'<%= session_key_name %>' : encodeURIComponent('<%= u cookies[session_key_name] %>'),
'authenticity_token' : encodeURIComponent('<%= u form_authenticity_token %>')}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment