let databox;
function initiate() {
  databox = document.getElementById("databox");
  const myfiles = document.getElementById("myfiles");
  myfiles.addEventListener("change", process);
}
function process(event) {
  databox.innerHTML = "";
  const files = event.target.files;
  const myfile = files[0];
  const reader = new FileReader();
  reader.addEventListener("load", function(event) {
    show(event, myfile);
  });
  reader.readAsArrayBuffer(myfile);
}
function show(event, myfile) {
  const url = URL.createObjectURL(myfile);
  const image = document.createElement("img");
  image.src = url;
  databox.appendChild(image);
}
window.addEventListener("DOMContentLoaded", initiate);