Skip to content

Instantly share code, notes, and snippets.

@cap10morgan
Created February 7, 2012 18:44
Show Gist options
  • Save cap10morgan/1761178 to your computer and use it in GitHub Desktop.
Save cap10morgan/1761178 to your computer and use it in GitHub Desktop.
RS Cloud Ruby Upload; Trying to set headers
require 'cloudfiles'
cf = CloudFiles::Connection.new( :username => 'turbovote', :api_key => '[hidden]' )
container = cf.container('forms-test')
object = container.create_object('test.pdf')
file_path = File.join("/", "tmp", "test.pdf")
headers = {
'content-type' => "application/pdf",
'content-disposition' => "attachment; filename=public_name.pdf",
'access-control-allow-origin' => "*"
}
object.write(File.open(file_path), headers)
object.set_metadata('expires_on' => 'dummy')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment