Module: OshparkFileExtensions

Included in:
File
Defined in:
lib/oshpark/ext.rb

Instance Method Summary collapse

Instance Method Details

#to_multipart(key = nil) ⇒ Object



44
45
46
47
48
49
# File 'lib/oshpark/ext.rb', line 44

def to_multipart key = nil
  "Content-Disposition: form-data; name=\"#{key}\"; filename=\"#{File.basename(self.path)}\"\r\n" +
  "Content-Transfer-Encoding: binary\r\n" +
  "Content-Type: application/#{File.extname(self.path)}\r\n\r\n" +
  "#{self.read}\r\n"
end