Paperclip: strange mime type on windows

When i upload a pdf, validations doesn’t work, only images validation
works. Avoiding check, file was loaded but with this content type:
file_content_type: “binary/octet-stream”

How can i solve? I’d like to have “application/pdf”

I partially solved using this plugin to get correct mime from extension:
http://code.google.com/p/mimetype-fu/

And in my model i added:

validate :validate_content_type

protected

def validate_content_type
errors.add(:file, “Format #{File.mime_type?(file.path)} is
invalid!”) unless File.mime_type?(file.path) == “application/pdf”
end

If somebody want to get better this code will be appreciated
Thanks in any case

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs