Rails回形针上传csv

时间:2017-08-18 14:10:38

标签: ruby-on-rails csv paperclip

我想用csv

上传paperclip个文件

但我有Paperclip::Errors::NotIdentifiedByImageMagickError

我的表格

<%= form_for Upload.new do |form| %> <%= form.file_field :file %> <%= form.submit%> <% end %>

模型

class Upload < ActiveRecord::Base
  has_attached_file :file, styles: { medium: "300x300>", thumb: "100x100>" },
      :path => ":rails_root/public/system/:attachment/:id/:style_:filename"
  validates_attachment_content_type :file,  content_type: ['text/plain', 'text/csv', 'application/vnd.ms-excel'], message: "is not in CSV format"

end

如何解决?

0 个答案:

没有答案