Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

load image file from input in html

function onFileSelected(event) {
  var selectedFile = event.target.files[0];
  var reader = new FileReader();

  var imgtag = document.getElementById("myimage");
  imgtag.title = selectedFile.name;

  reader.onload = function(event) {
    imgtag.src = event.target.result;
  };

  reader.readAsDataURL(selectedFile);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #load #image #file #input #html
ADD COMMENT
Topic
Name
6+2 =