檔案輸入“接受”屬性 - 有用嗎? - File input 'accept' attribute - is it useful?
問題:
Implementing a file upload under html is fairly simple, but I just noticed that there is an 'accept' attribute that can be added to the <input type="file" ...>
tag.在 html 下實現檔案上傳相當簡單,但我剛剛注意到有一個 'accept' 屬性可以新增到<input type="file" ...>
標籤中。
Is this attribute useful as a way of limiting file uploads to images, etc?這個屬性作為限制檔案上傳到影象等的方式有用嗎? What is the best way to use it?使用它的最佳方法是什麼?
Alternatively, is there a way to limit file types, preferably in the file dialog, for an html file input tag?或者,有沒有辦法限制 html 檔案輸入標籤的檔案型別,最好是在檔案對話方塊中?
解決方案:
參考一: http://stackoom.com/question/l8o參考二: File input 'accept' attribute - is it useful?
「其他文章」
- 如何在 JavaScript 中編寫內聯 IF 語句? - How to write an inline IF statement in JavaScript?
- 如何限制 Parallel.ForEach? - How can I limit Parallel.ForEach?
- python:如何識別變數是陣列還是標量 - python: how to identify if a variable is an array or a scalar
- 使用 Windows 命令提示符安裝 Windows 服務? - Install a Windows service using a Windows command prompt?
- 如何在沒有我自己的登錄檔的情況下安裝私有 NPM 模組? - How to install a private NPM module without my own registry?
- 如何使用 pip 更新/升級包? - How to update/upgrade a package using pip?
- 條件使用NOT NIL的Rails - Rails where condition using NOT NIL
- 像屬性一樣訪問字典鍵? - Accessing dict keys like an attribute?
- 檔案輸入“接受”屬性 - 有用嗎? - File input 'accept' attribute - is it useful?
- Python while 語句上的 Else 子句 - Else clause on Python while statement
- 正則表示式匹配兩個單詞之一 - Regex match one of two words
- 我們如何下載 blob url 影片 [關閉] - How do we download a blob url video [closed]
- 比較兩個字串,忽略 C# 中的大小寫 [重複] - Comparing two strings, ignoring case in C# [duplicate]
- Java 介面/實現命名約定 [重複] - Java Interfaces/Implementation naming convention [duplicate]
- 如何檢查是否在 Cygwin、Mac 或 Linux 中執行? - How to check if running in Cygwin, Mac or Linux?
- Java 日期與日曆 - Java Date vs Calendar
- 在 JavaScript 中將日期轉換為另一個時區 - Convert date to another timezone in JavaScript
- 為SQL Server Express 2012啟用遠端連線 - Enable remote connections for SQL Server Express 2012
- 如何從程式碼中獲取裝置的IP地址? - How to get IP address of the device from code?
- 獲取簡短的 Git 版本雜湊 - Get the short Git version hash