简体   繁体   中英

Why HTML `<input type=“file” />` accept property `audio/mpeg` and `audio/mp3` works the same if I just want to select MP3?

Please see these two minimum examples

audio/mpeg

 <input type="file" accept="audio/mpeg">

audio/mp3

 <input type="file" accept="audio/mp3">

Both examples can select the only MP3, why is this happening?

If I want to force my user to just select an MP3 file, which code snippet should I use?

Which one is the best?

An MP3 is just the audio portion of a MPEG file, so specifying audio/mpeg is equivalent to specifying audio/mp3 .

More info about media formats can be found in this article on MDN.

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