我在表单上上传了文件,当我上传名为“theManifest.manifest”或“theManifest.appcache”的文件时,mime 类型不正确。
我在我的 php 代码中使用“echo”来告诉我上传文件的详细信息——这是代码:
<form enctype="multipart/form-data" action="file-upload.php" method="POST">
Upload the manifest file:<input type="file" name="uploaded" id="id_upload" />
<input type="submit" value="Upload" />
</form>
这是告诉我文件是什么的php代码:
echo "<br> The file that was uploaded is as follows:";
echo "<br>uploaded_name = " . $_FILES['uploaded']['name'];
echo "<br>uploaded_size = " . $_FILES['uploaded']['size'];
echo "<br>uploaded_type = " . $_FILES['uploaded']['type'];
echo "<br>uploaded_tmp_name = " . $_FILES['uploaded']['tmp_name'];
echo "<br>uploaded_error = " . $_FILES['uploaded']['error'];
这是我得到的输出:
The file that was uploaded is as follows:
uploaded_name = theManifest.appcache
uploaded_size = 51
uploaded_type = application/octet-stream
uploaded_tmp_name = C:\xampp\tmp\php4064.tmp
uploaded_error = 0;
我只是不明白为什么在 Windows Vista 上运行的 Firefox 8 认为 .manifest 和 .appcache 文件都是“application/octet-stream”的 MIME 类型。
这是我的 .appcache 文件的内容,有时用 .manifest 重命名以测试这个问题。
#This is a blank, test-cases-only, .manifest file.
这是一个带有注释(.manifest 样式的注释)的文本文件,没有其他内容。
知道为什么 MIME 类型在这里是“应用程序/八位字节流”吗???
正确的MIME 类型,我应该在上面的代码中看到的那个——据我所知是“text/cache-manifest”——而不是“application/octet-stream”