lib/carrierwave/storage/ftp.rb in carrierwave-ftp-0.2.4 vs lib/carrierwave/storage/ftp.rb in carrierwave-ftp-0.2.5
- old
+ new
@@ -35,9 +35,16 @@
def filename(options = {})
url.gsub(/.*\/(.*?$)/, '\1')
end
+ def to_file
+ temp_file = Tempfile.new(filename)
+ temp_file.binmode
+ temp_file.write file.body
+ temp_file
+ end
+
def size
size = nil
connection do |ftp|
ftp.chdir(::File.dirname "#{@uploader.ftp_folder}/#{path}")