Advertisement
STANAANDREY

get b64 img

Mar 4th, 2022
1,070
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.66 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5.     <title>
  6.         doc </title>
  7. </head>
  8.  
  9. <body onload="">
  10.     <h1 style="color: green">
  11.         tralala
  12.     </h1>
  13.  
  14.     <img id="img1" src="" alt="">
  15.     <img src="http://placekitten.com/40/40">
  16.     <br><br><br>
  17.     img <br>
  18.     <input type="file" onchange="encodeImageFileAsURL(this)" />
  19. </body>
  20. <script type="text/javascript">
  21.     function encodeImageFileAsURL(element) {
  22.         var file = element.files[0];
  23.         var reader = new FileReader();
  24.         reader.onloadend = function () {
  25.             console.log('RESULT', reader.result)
  26.         }
  27.         reader.readAsDataURL(file);
  28.     }
  29. </script>
  30.  
  31. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement