CINXE.COM
File upload example with accept
<!DOCTYPE html> <html lang="en-US"> <head> <title>File upload example with accept</title> <style> div { margin-bottom: 10px; } </style> </head> <body> <form> <div> <label for="profile_pic">Choose file to upload</label> <input type="file" id="profile_pic" name="profile_pic" accept=".jpg, .jpeg, .png"> </div> <div> <button>Submit</button> </div> </form> <script> var test = document.querySelector('input'); </script> </body> </html>