<pre>var input = document.getElementById('input'); input.addEventListener('change', handleFiles); function handleFiles(e) { var ctx = document.getElementById('canvas').getContext('2d'); var img = new Image; img.src = URL.createObjectURL(e.target.files[0]); img.onload = function() { ctx.drawImage(img, 20,20); alert('the image is drawn'); } }
<pre><h1>Test</h1> <input type="file" id="input"/> <canvas width="400" height="300" id="canvas"/>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)