在 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>
廣告