<div>
  <h1>Can select only .png and .jpg files</h1>
  <input type="file" id="file-uploader" accept=".jpg, .png" multiple>
  <p>Upload files and see the output in browser console</p>
</div>
html {
  height: 100%;
}

body {
  background: #000000;
  color: #FFFFFF;
}

div {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  font-family: 'Roboto Mono', monospace;
}
const fileUploader = document.getElementById('file-uploader');

fileUploader.addEventListener('change', (event) => {
  const files = event.target.files;
  console.log('files', files);
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.