Upgrading 1.8.7 to 1.9.3, paperclip s3 upload not working

☆樱花仙子☆ 提交于 2019-12-06 12:21:40
Parth

I found the solution after i checked the exception thrown while doing model.save!.

Basically, the content type validation was failing for the uploaded image file. This was working with paperclip 2.70, but for >3.0 version we need to change as following.

#The old contentType setting is commented out    
#validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/pjpeg', 'image/jpg', 'image/png']  

validates_attachment_content_type :photo, :content_type => /image/

So now, image has been uploaded successfully on amazon s3 server.

Reference

Validate Attachment Content Type Paperclip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!