Some details when using URL.createObjectURL to preview images on the front end

  1. URL.createObjectURL
  2. define img.src to create an img element that will display the picture
  3. use appendChild instead of innerHTML
  4. URL.revokeObjectURL