[英]File API returns “invalid/octet-stream” for pdf file in Firefox
I'm doing file upload which checks file mime type in browser. 我正在执行文件上传,该文件检查浏览器中的文件mime类型。 It's uses jQuery File Upload Plugin and works good everywhere except one user. 它使用jQuery File Upload Plugin,除一个用户外,其他任何地方都可以正常工作。
For some reason file.type (html5 file api) returns " invalid/octet-stream " for pdf file (usually it's "application/pdf"). 由于某种原因,pdf文件的file.type(html5文件api)返回“ invalid / octet-stream ”(通常是“ application / pdf”)。 Pdf file is simple and can be opened at this pc without any problems. PDF文件很简单,可以在此PC上打开而没有任何问题。
Environment: Windows 7 and Firefox 40. Not reproduced in chrome or explorer. 环境:Windows 7和Firefox40。不在chrome或Explorer中复制。
Try deleting (or renaming/moving, for testing purposes) the file MimeTypes.rdf in the affected Firefox's profile folder . 尝试删除(或重命名/移动,以进行测试)受影响的Firefox的配置文件文件夹中的MimeTypes.rdf 文件 。
(Under Windows this can usually be found under a path similar to c:\\Users\\[name]\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\[some id].default - or just search for "MimeTypes.rdf".) (在Windows下,通常可以在类似于c:\\ Users \\ [name] \\ AppData \\ Roaming \\ Mozilla \\ Firefox \\ Profiles \\ [some id] .default的路径下找到-或仅搜索“ MimeTypes.rdf”。)
If the PDF upload works afterwards, you encountered a Firefox bug that was first reported in 2007 ( basically the same here , reported in 2006). 如果PDF上传之后可以正常工作,则您遇到了Firefox错误 ,该错误于2007年首次报告( 此处基本相同 ,于2006年报告)。 In a nutshell, any web site from which the user ever downloads a file has the potential to corrupt the MimeTypes.rdf file in regards to the extension of the downloaded file - maliciously or accidentally/unknowingly. 简而言之,就下载的文件的扩展名而言,用户曾经从中下载文件的任何网站都有可能破坏MimeTypes.rdf文件,这是恶意的,无意的/无意的。
Things you can do: 您可以做的事情:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.