简体   繁体   中英

use of capture attribute in html input tag

I would like to have an input html tag to allow my user to upload a image file or a pdf file or to capture a photo (and not a video or audio file). Is it possible to do such a thing ? I tried several codes (including the following one), but none of them work as expected

<input type="file" accept="images/*, .pdf" capture>

Check for the correct types here: https://www.iana.org/assignments/media-types/media-types.xhtml

You need these types:

 <input type="file" accept="image/*, application/pdf">

However, people will still be able to upload video files. You need serverside validation to prevent people to upload wrong files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM