Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails WebVtt的内容类型是什么?_Ruby On Rails_Ruby_Paperclip_Content Type_Webvtt - Fatal编程技术网

Ruby on rails WebVtt的内容类型是什么?

Ruby on rails WebVtt的内容类型是什么?,ruby-on-rails,ruby,paperclip,content-type,webvtt,Ruby On Rails,Ruby,Paperclip,Content Type,Webvtt,我想允许我的应用程序允许上传.vtt文件。现在它只接受.txt文件,但我想为字幕添加.vtt功能 我试过这个,但运气不好: validates_attachment_content_type :caption, :content_type => ['application/txt', 'text/plain', 'WEBVTT', 'application/vtt', 'vtt'] 这种情况下的正确格式是什么?WebVTT标题文件的MIME类型为text/vtt,如中所述。WebV

我想允许我的应用程序允许上传.vtt文件。现在它只接受.txt文件,但我想为字幕添加.vtt功能

我试过这个,但运气不好:

validates_attachment_content_type :caption, 
  :content_type => ['application/txt', 'text/plain', 'WEBVTT', 'application/vtt', 'vtt']

这种情况下的正确格式是什么?

WebVTT标题文件的MIME类型为
text/vtt
,如中所述。WebVTT的MIME类型为
text/vtt
:不起作用。有什么想法吗?WebVTT是一个非常新的标准,也是一种非常新的MIME类型。Rails可能还不知道。您可能只需要检查扩展,或者通过检查实际数据来进行自己的验证。