This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// html | |
// <input type="file" onchange="imagesSelected" multiple accept=".gif,.jpg,.jpeg,.png" /> | |
async function imagesSelected(event) { | |
let files = [...event.target.files]; | |
let images = await Promise.all(files.map(f=>{return readAsDataURL(f)})); | |
//all images' base64encoded data will be available as array in images | |
} | |
function readAsDataURL(file) { |