如何用回形针上传图片?

时间:2018-02-08 10:30:44

标签: ruby-on-rails

Iam使用rails 4.2 ....我安装了paperclip gem,配置正确,但每当我上传任何图片时,我都会通过浏览器重置'连接已被重置',这里是我得到的:

begin transaction
Command :: file -b --mime "C:/Users/hol~1/AppData/Local/Temp/795eb2377370d89bc93f7f30ac4c055020180208-7336-1o5t9vu.png"
[paperclip] Content Type Spoof: Filename cat-1285634_640.png (image/png from Headers, ["image/png"] from Extension), content type discovered from file command: . See documentation to allow this combination.
   (0.0ms)  rollback transaction

我的帖子模型

class Post < ActiveRecord::Base
  belongs_to :user
    has_attached_file :image, styles: { medium: "300x300>", thumb: "100x100>" }, default_url: ""
  validates_attachment_content_type :image, content_type: /\Aimage\/.*\z/
    validates_length_of :description, :minimum => 15
      end

0 个答案:

没有答案