ruby on rails - Read data image, upload from web and save them in a database -


i'm newest in ruby on rails developpement , best way save pictures/image controller of web page. try this:

@fin = file.open(params[:photos] , "rb") @img = @fin.read 

i think have understand reasoning. @ end want able save picture database.

i recommend use gem carrierwave: https://github.com/carrierwaveuploader/carrierwave

you should not save picture database. instead should store image on sort of other datastore , put pointer in database. carrierwave makes easy , has different adapters store images on local filesystem, s3, sftp, or nfs.

thoughtbot's paperclip alternative: https://github.com/thoughtbot/paperclip


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -