Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> </head> <body> <input type="file" onchange="encodeImageFileAsURL(this)" /> <script> function encodeImageFileAsURL(element) { let file = element.files[0]; let reader = new FileReader(); reader.onloadend = function() { document.write('RESULT: ', reader.result); } reader.readAsDataURL(file); } </script> </body> </html>