@contact = Contact.new
@contact.file_file_name=params[:contact][:file].original_filename
@contact.file_content_type=params[:contact][:file].content_type.chomp
@contact.file=params[:contact][:file].read
@contact.save
the first two elements work,
@contact.file=params[:contact][:file].read results empty, can you say
me where I am wrong.
Sergio
Hi Sergio,
It looks like you’re using Paperclip, based on the “file_name_name”
and “file_content_type” etc., attributes? Is this right? I’m not
sure… if you’re not, you should try Paperclip.
I wrote an extension to Paperclip to handle saving to a DB BLOB; see
http://patshaughnessy.net/paperclip-database-storage
Here’s a tutorial/example on how to save a file as a BLOB:
http://patshaughnessy.net/2009/5/29/paperclip-sample-app-part-3-saving-file-attachments-in-a-database-blob-column
On Jun 17, 9:21 am, Sergio A. [email protected]