Skip to content

Instantly share code, notes, and snippets.

@latortuga
Created December 8, 2012 20:13
Show Gist options
  • Save latortuga/4241729 to your computer and use it in GitHub Desktop.
Save latortuga/4241729 to your computer and use it in GitHub Desktop.
Setup Uploadify to upload directly to S3
var uploadify_data = {
'AWSAccessKeyId': '<%= @uploadify_data[:access_key] %>',
'bucket': '<%= @uploadify_data[:bucket] %>',
'acl': 'private',
'key': '<%= @uploadify_data[:key] %>${filename}',
'signature': '<%= @uploadify_data[:signature] %>',
'policy': '<%= @uploadify_data[:policy] %>',
'success_action_status': '<%= @uploadify_data[:sas] %>',
'folder': '',
'Filename': ''
}
function uploadify_success(file, data, response) { }
$(document).ready(function() {
$('#contact_file_field').uploadify({
swf: "<%= asset_path('uploadify.swf') %>",
uploader: "<%= @s3_url %>",
formData: uploadify_data,
fileSizeLimit: <%= @uploadify_data[:filesize] %>,
fileObjName: "file", // Necessary, DO NOT remove this.
onUploadSuccess: uploadify_success,
multi: true
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment