<input type='file' id="fileUpload" <canvas id="colors_sketch" width="800" height="600" style="background-color:#ffffff;"></canvas>
function el(id) { return document.getElementById(id); } // Get elem by ID var canvas = el("colors_sketch"); var context = canvas.getContext("2d"); function readImage() { if (this.files && this.files[0]) { var FR = new FileReader(); FR.onload = function (e) { var img = new Image(); img.onload = function () { context.drawImage(img, 0, 0,img.width,img.height,0,0,800,600); }; img.src = e.target.result; }; FR.readAsDataURL(this.files[0]); } } el("fileUpload").addEventListener("change", readImage, false);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)