Paperclip无法上传mp3文件

时间:2016-05-29 00:21:19

标签: ruby-on-rails-4 audio paperclip mp3

我正在尝试将音频文件上传到我的网站。但是,Paperclip无法上传我尝试上传的任何mp3文件。出于某种原因,虽然我能够上传wav文件。我发现了类似的问题,但没有一个答案对我有用。任何建议都将不胜感激。

Audio.rb

has_attached_file :audio
validates_attachment_content_type :audio, content_type: ['application/mp3','application/x-mp3', 'audio/mpeg', ['audio/mpeg'], 'audio/mp3']
validates_attachment_size :audio, :less_than => 35.megabytes

错误

[paperclip] Content Type Spoof: Filename test.mp3 (binary/octet-stream from Headers, ["audio/mpeg"] from Extension), content type discovered from 
file command: audio/mpeg. See documentation to allow this combination.
[paperclip] Content Type Spoof: Filename test.mp3 (binary/octet-stream from Headers, ["audio/mpeg"] from Extension), content type discovered from file command: audio/mpeg. See documentation to allow this combination.
(0.1ms)  ROLLBACK
(0.1ms)  ROLLBACK

0 个答案:

没有答案
相关问题