Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dtrce
Created March 4, 2012 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtrce/1970280 to your computer and use it in GitHub Desktop.
Save dtrce/1970280 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'aws/s3'
module S3Util
def self.upload_file(local_file)
mime_type = "application/octet-stream"
bucket = "loanapp"
AWS::S3::Base.establish_connection!(
:access_key_id => '*****',
:secret_access_key => '****'
)
base_name = File.basename(local_file)
puts "**** Uploading #{local_file} as '#{base_name}' to '#{bucket}'"
AWS::S3::S3Object.store(
base_name,
File.open(local_file),
bucket,
:content_type => mime_type
)
puts "***** Uploaded!"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment