0
0

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 1 year has passed since last update.

accept属性

Posted at

HTMLのaccept属性は、フォームのinputタグ内で使用され、ユーザーがアップロードできるファイルの種類を指定します。
この属性はtype="file"のinput要素で使用されます。

accept属性の値は、特定のファイル拡張子(例:".jpg",".png")
またはMIMEタイプ(例:"image/","audio/","video/*","application/pdf")を指定することで、どの種類のファイルをアップロードできるかを制限します。

画像ファイルのみ受け入れる場合:

<input type="file" accept="image/*">

特定の画像ファイル形式(例:jpgとpng)のみ受け入れる場合:

<input type="file" accept=".jpg, .png">

複数の異なる種類のファイルを受け入れる場合:

<input type="file" accept=".jpg, .png, .doc, .pdf">
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?