Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uploading Pictures Ruby on Rails

I am new to rails so sorry if this is easy. I am wondering the best way to upload pictures and display them in Ruby on Rails. I have a blog and would like to have the option of attaching a picture when creating a post.

like image 565
bgadoci Avatar asked Dec 07 '09 00:12

bgadoci


People also ask

How do I upload multiple images in rails?

A file can be uploaded to server in two ways, one we can send the image as base64 string as plain text and another one is using multipart/form-data . The first one is the worst idea as it sends the entire image as plain text.

Is it OK to upload images to database?

The image can be uploaded directly to the database without storing on the server. But it will increase the database size and web page load time. So, it's always a good idea to upload images to the server and store file names in the database.


1 Answers

Paperclip is quite awesome. There's an excellent RailsCast about it - http://railscasts.com/episodes/134-paperclip

like image 142
danpickett Avatar answered Oct 01 '22 08:10

danpickett