Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upload audio files using Paperclip in Rails 3?

I'm very new to Rails. Basically, I have a Sound model that uploads an audio file(wav) and store it somewhere on the local machine (for testing). How to set it up using Paperclip? I googled but unfortunately most of the tutorials are about image uploading:-(

Any inputs are greatly appreciated.

like image 358
saurb Avatar asked Oct 13 '10 03:10

saurb


People also ask

How do you use a paperclip in rails?

Setting Up PaperclipTo set up Paperclip, first we need to install the ImageMagick dependency. Paperclip uses ImageMagick to resize images after upload. If you are using another system, you can get download and install instructions from the ImageMagick website. Run bundle install to finish it up.

What is Paperclip in Rails?

Paperclip is an easy file attachment library for Rails Applications. Attached files are saved to the file system, database or cloud and referenced in the browser by an easily understandable specification.


1 Answers

class Sound
  has_attached_file :audio  ,
                    :url => "/assets/:class/:id/:attachment/:style.:extension",
                    :path => ":rails_root/public/assets/:class/:id/:attachment/:style.:extension"

end
like image 143
Jeremy Woertink Avatar answered Nov 13 '22 22:11

Jeremy Woertink