Has anyone else seen this?
I'm using rails 3 with paperclip, when I upload a .doc it works great application/msword but when I upload a .docx the content_type is being saved as application/zip.
thoughts?
Ironically IE can have difficulty recognising the new MS Office files while other browsers recognise them fine.
In order to get IE working with these files you need to add the mime types to the server config. In Rails this is done in config/initializers/mime_types.rb
Mime::Type.register "application/vnd.openxmlformats-officedocument.wordprocessingml.document", :docx
Mime::Type.register "application/vnd.openxmlformats-officedocument.presentationml.presentation", :pptx
Mime::Type.register "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", :xlsx
If your app is proxied through Apache and Apache serves your static assets you'll also have to configure apache with the new mime types (and restart) as per http://bignosebird.com/apache/a1.shtml
My mime types were located at /etc/mime.types but try locate mime.types
if you're not sure.
I've seen this using IE with SSL. If that's the case for you, take a look at http://www.kalzumeus.com/2010/10/25/how-to-use-ssl-to-secure-your-rails-app-against-firesheep-and-other-evils/
(The section called "Host downloadable files on SSL? You just broke IE.")
this may also help: Rails PDF Generation with Prawn in IE7
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With