Skip to content

Instantly share code, notes, and snippets.

View martindebrunne's full-sized avatar

Martin DEBRUNNE martindebrunne

View GitHub Profile
@martindebrunne
martindebrunne / amazon_service.rb
Last active May 3, 2017 17:21
Get a s3 signature for Ruby (used in ROR here) and how to set an image uploader using s3
class AmazonService
class << self
def get_s3_upload_key(user_folder, project_folder)
bucket = < TO FILL >
access_key = < TO FILL >
secret_key = < TO FILL >
env = ENV["S3_ENV"]
key = "#{env}/#{user_folder}/#{project_folder}/"
expiration = 1.days.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z')
max_filesize = 16.megabytes