简体   繁体   English

为什么上传的.appcache或.manifest文件的mime类型为“ application / octet-stream”?

[英]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.

相关问题 为什么我将MIME类型的.csv文件作为“ application / octet-stream”获得? - Why am I getting mime-type of .csv file as “application/octet-stream”? 服务器上的PHP文件上传将mime-type更改为application / octet-stream - PHP file upload on server changed mime-type to application/octet-stream Laravel 视频上传 - ios 设备、mime 类型应用程序/八位字节流的问题 - Laravel video upload - issue with ios device, mime-type application/octet-stream 如何处理图像的mime类型“application / octet-stream”? - how handling image's mime type “application/octet-stream”? 应用程序/八比特流MIME类型是否可以安全上传? - Is the application/octet-stream MIME type safe for uploading? Codeigniter的应用程序/八位字节流MIME类型问题 - application/octet-stream mime type issue with codeigniter 获取上载图像的MIME类型是application / octet-stream - Getting Upload Image mime type is application/octet-stream 为什么 mime_content_type 上的某些 mp3 返回应用程序/八位字节流 - why some mp3s on mime_content_type return application/octet-stream 文件下载资源被解释为文档,但以MIME类型application / octet-stream传输 - file download Resource interpreted as Document but transferred with MIME type application/octet-stream PHP生成的JSON文件具有application / octet-stream mime类型 - JSON file generated by PHP has application/octet-stream mime type
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM