[英]why is the mime-type of an uploaded .appcache or .manifest file — “application/octet-stream”?
I have a file upload on a form and when I upload my file called "theManifest.manifest" or "theManifest.appcache" the mime-type is not correct. 我在表单上上传了文件,当我上传名为“ theManifest.manifest”或“ theManifest.appcache”的文件时,MIME类型不正确。
I use 'echo' in my php code to tell me the details of the file that was uploaded -- here is the code: 我在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>
Here is the php code that tells me what the file is: 这是告诉我文件是什么的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'];
Here's the output I get: 这是我得到的输出:
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;
I just don't see why Firefox 8 running on Windows Vista thinks that both the .manifest and .appcache files are the MIME-type of "application/octet-stream". 我只是不明白为什么Windows Vista上运行的Firefox 8认为.manifest和.appcache文件都是“应用程序/八位字节流”的MIME类型。
Here are the contents of my .appcache file, renamed with .manifest at times to test this problem. 这是我的.appcache文件的内容,有时用.manifest重命名以测试此问题。
#This is a blank, test-cases-only, .manifest file.
This is a text file with a comment (.manifest-style comment) and nothing else. 这是一个带有注释(.manifest样式的注释)的文本文件。
Any idea why the MIME-type is "application/octet-stream" here ??? 知道为什么MIME类型是“ application / octet-stream”吗?
The correct MIME type, the one I should see reported in the code above -- is to the best of my knowledge "text/cache-manifest" -- and not "application/octet-stream" 据我所知, 正确的 MIME类型是在上面的代码中报告的-据我所知,它是“ text / cache-manifest”,而不是“ application / octet-stream”
It's unlikely that your computer (or Firefox) associates the file extensions .appcache
and .manifest
with MIME type text/cache-manifest
. 您的计算机(或Firefox)不太可能将文件扩展名
.appcache
和.manifest
与MIME类型的text/cache-manifest
关联。 And it is quite possibly unimportant. 这很可能不重要。
It matters a lot when the browser is downloading the file because without the correct MIME type, the browser won't treat the file as an appcache manifest. 当浏览器下载文件时,这很重要,因为如果没有正确的MIME类型,浏览器将不会将该文件视为appcache清单。
But for a file upload, the MIME type is quite possibly unimportant for an appcache manifest, at least typically. 但是对于文件上传来说,MIME类型对于应用程序缓存清单来说可能并不重要,至少通常是这样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.