I am doing a project which allows user to upload image.
My problem is how can i save the information of image in database MySQL like:
image_path;
image_type;
image_desc:
2 Answers
2 Comments
nehit
Thanks... i already use the Paperclip for uploading now what i want is to save the image information in MySQL database
Syed Aslam
If you go through the README, it is described that you should add certain fields to you model and say has_attached_file :whatever and so on. Please go through the documentation. It's pretty easy to use.
You can use the gem https://github.com/thoughtbot/paperclip. The image_desc you can to save independently.
Image.create(:image => params[:file], :image_desc => params[:desc])
3 Comments
nehit
hey! my images are saved in hard disk but i want to save the information regarding that image in database MySQL
Alex Dmitriev
I think the image_path you know Rails.root.to_s + "your/path/to/file". File type as paperclip github.com/thoughtbot/paperclip/blob/master/lib/paperclip/…
nehit
Not getting your point clearly,like as i save the image in hard disk ,i want its save the information of that image in MySQL like name ,path,type ....