问题
I want to use paperclip to upload files to server. Errors are all cleaned now, but I don't know how to set the upload path.
My code looks like this:
upload class:
puts has_attached_file :image, :default_url => :file_system
validates_attachment_content_type :image, :content_type => [:image, 'audio/mpeg', 'application/mp3', 'application/octet-stream']
I want to save uploads in project/public/uploads.
How can I realise this?
回答1:
Then it should look like this:
has_attached_file :image,
:path => ":rails_root/public/uploads/:filename",
:url => "/uploads/:filename"
来源:https://stackoverflow.com/questions/29736467/ruby-on-rails-paperclip-questions