Created
April 24, 2011 19:16
-
-
Save amalagaura/939806 to your computer and use it in GitHub Desktop.
Monkey patch idea to get streaming uploads for carrierwave
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CarrierWave | |
module Storage | |
class S3 | |
class File | |
def store(file) | |
content_type ||= file.content_type # this might cause problems if content type changes between read and upload (unlikely) | |
connection.put_object(bucket, path, file.open, | |
{ | |
'x-amz-acl' => access_policy.to_s.gsub('_', '-'), | |
'Content-Type' => content_type | |
}.merge(@uploader.s3_headers) | |
) | |
end | |
end | |
end | |
end | |
end | |
module CarrierWave | |
class SanitizedFile | |
def open | |
File.open(@file) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment