CodeIgniter:错误上传文件mime类型 [英] CodeIgniter: wrong uploading file mime type
问题描述
有时,当使用< input>
标记上传文件时,遇到问题,其中文件扩展名与 application / config / mimes.php
。例如,当我上传一个 .doc
文件时,事实证明它的MIME类型实际上是 application / octet-stream
,而不是 application / msword
。
Sometimes, when uploading files using <input>
tag, I encounter problem where the file extension doesn't match with its mime type defined in application/config/mimes.php
. For example when I upload a .doc
file, it turns out that its mime type is actually application/octet-stream
, not application/msword
as expected.
我过去有这个问题。我通过添加 application / octet-stream
到 .doc
mime数组。但是有正确的方法来修复它吗?
I had this problem sometimes in the past. I did work around by adding application/octet-stream
to .doc
mime array. But is there a proper way to fix it?
我认为浏览器强制我的文件的MIME类型不知何故。是否有任何种类的HTTP标头或HTML元标记来防止这种情况?
I think the browser have force my file's mime type somehow. Is there any kind of HTTP header or html meta tag to prevent this?
推荐答案
正如你可以看到这里这是一个常见的问题,您应用的解决方案是合法的。
As you can see here this a common problem and the solution you applied is legitimate.
这篇关于CodeIgniter:错误上传文件mime类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!