Tag: mongoid paperclip

Mongoid-peperclip 内容类型欺骗:错误

我需要通过mongoid-paperclip上传一些大型CSV文件,我收到错误Uploaded file2 my_file has an extension that does not match its contents 。 在终端中我可以看到此错误为[paperclip] Content Type Spoof: my_file.csv ([“text/csv”, “text/comma-separated-values”]), content type discovered from file command: application/octet-stream. See documentation to allow this combination. 好吧,我将validation设置为do_not_validate_attachment_file_type :my_file它没有帮助相同的错误。 在application.rb我添加了这一行 Paperclip.options[:content_type_mappings] = { jpeg: ‘image/jpeg’, jpg: ‘image/jpeg’ } 然后改为这个 Paperclip.options[:content_type_mappings] = { csv: ‘text/csv’} 它也没有帮助,同样的错误Uploaded file2 my_file has an […]