Advertisement
krot

Paste an image

May 24th, 2022
863
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <textarea id="target">Paste an image here</textarea>
  2. <script>
  3.   const target = document.getElementById('target');
  4.  
  5.   target.addEventListener('paste', (e) => {
  6.     e.preventDefault();
  7.     doSomethingWithFiles(e.clipboardData.files);
  8.   });
  9. </script>
  10. https://web.dev/media-capturing-images/
Advertisement
RAW Paste Data Copied
Advertisement