在 HTML 中設定伺服器接受的檔案型別


使用 HTML 中的 accept 屬性設定伺服器接受的檔案型別。僅將該屬性與 <input type = "file"> 一起使用。

示例

可以嘗試執行以下程式碼以使用 accept 屬性 −

<!DOCTYPE html>
<html>
   <head>
      <title>File Upload Box</title>
   </head>
   <body>
      <form>
         <input type = "file" name = "fileupload" accept = "image/*" />
      </form>
   </body>
</html>

更新於:2020 年 3 月 2 日

121 次檢視

開啟您的 職業生涯

完成課程獲得認證

入門體驗
廣告