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


使用 accept 屬性可以設定伺服器在 HTML 中接受的檔案型別。該屬性只能用於 <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 次瀏覽

開啟您的 職業生涯

透過完成課程獲得認證

開始
廣告
© . All rights reserved.