lib/attached/storage/aws.rb in attached-0.3.4 vs lib/attached/storage/aws.rb in attached-0.3.5
- old
+ new
@@ -56,13 +56,17 @@
#
# * file - The file to save.
# * path - The path to save.
def save(file, path)
+ file = File.open(file.path)
+
directory = connection.directories.get(self.bucket)
directory ||= connection.directories.create(self.permissions.merge(:key => self.bucket))
- directory.files.create(self.options(path).merge(self.permissions.merge(:key => path, :body => file.read)))
+ directory.files.create(self.options(path).merge(self.permissions.merge(:key => path, :body => file)))
+
+ file.close
end
# Destroy a file at a given path.
#
\ No newline at end of file