相关疑难解决方法(0)

Paperclip is not supporting .doc file

In rails 4.0.2, I am using paperclip gem to upload files. But it is not supporting .doc file. Below the file upload field, it is showing an error message as "has an extension that does not match its contents"

In model, the validation for checking the content type is given below :

validates_attachment_content_type :document, :content_type => ['application/txt', 'text/plain',
'application/pdf', 'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.oasis.opendocument.text',
'application/x-vnd.oasis.opendocument.text',
'application/rtf', 'application/x-rtf', 'text/rtf', 
'text/richtext', 'application/doc', 'application/docx', 'application/x-soffice', 'application/octet-stream']
Run Code Online (Sandbox Code Playgroud)

Gems which is used right now

rails (4.0.2, 4.0.0, …
Run Code Online (Sandbox Code Playgroud)

ruby validation ruby-on-rails file paperclip

3
推荐指数
2
解决办法
3547
查看次数

标签 统计

file ×1

paperclip ×1

ruby ×1

ruby-on-rails ×1

validation ×1