我有一個文件上傳在表單上,當我上傳我的文件稱爲「theManifest.manifest」或「theManifest.appcache」時,MIME類型是不正確的。爲什麼上傳的.appcache或.manifest文件的MIME類型是「application/octet-stream」?
我用「回聲」在我的PHP代碼,告訴我這是上傳的文件的詳細信息 - 這裏是代碼:
<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;
我只是不明白爲什麼的Firefox 8在Windows Vista上運行的日墨水,這兩個.manifest和.appcache文件是 「application/octet-stream」的MIME類型。
下面是我的.appcache文件的內容,有時用.manifest重命名以測試此問題。
#This is a blank, test-cases-only, .manifest file.
這是一個包含註釋(.manifest樣式註釋)的文本文件,沒有別的。
任何想法爲什麼MIME類型是「application/octet-stream」在這裏?
的正確 MIME類型,我應該在上面的代碼中看到報道的一個 - 就是盡我所知 「文本/緩存清單」的 - 而不是「應用程序/八位字節流」