35
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CSVファイルのMIMEタイプが環境によって異なる

Last updated at Posted at 2019-07-26

Microsoft Excelがインストールされているどうかで、CSVファイルのMIMEタイプが変わることがわかりました。

OS Browser EXCEL MIMEタイプ
Windows10 Chrome application/vnd.ms-excel
Windows10 Chrome application/octet-stream
Windows10 Firefox application/vnd.ms-excel
Windows10 Firefox application/octet-stream

CSVファイルのMIMEタイプを表示するサンプル

mime_check.php
<!doctype html>
<meta charset="utf-8">
<title>MIMEチェック</title>

<?php
if (isset($_FILES['target'])) {
   echo '<p>MIMEタイプ:<strong>'.$_FILES['target']['type'].'</strong></p>';
}
?>

<h1>MIMEタイプを調べたいファイルを選択してください</h1>
<form method="post" enctype="multipart/form-data">
    <input type="file" name="target" onchange="submit(this.form)">
</form>
35
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
35
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?