Search
 
SCRIPT & CODE EXAMPLE
 

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);
}
Comment

input file img / input file image

<div class="image-upload">
  <label for="file-input">
    <img src="https://icons.iconarchive.com/icons/dtafalonso/android-lollipop/128/Downloads-icon.png"/>
  </label>

  <input id="file-input" type="file" />
</div>


 // CSS

.image-upload>input {
  display: none;
}
Comment

PREVIOUS NEXT
Code Example
Html :: hide table html 
Html :: game code in html 
Html :: mat-toolbar 
Html :: block view source html 
Html :: form row twig symfony 
Html :: HTML SVG Graphics 
Html :: how to make a class in html 
Html :: table bootstrap 
Html :: icon for instagram in bootstrap 
Html :: html <strong 
Html :: smaller than small html 
Html :: scrape beautifulsoup python html attribute value 
Html :: cellpadding in html 
Html :: how to put the heading in th ecenter of th html page 
Html :: hide or show element in javascript 
Html :: check html 
Html :: html select option text color 
Html :: bootstrap upload image plugin for html 
Html :: html title tag 
Html :: u tag in html 
Html :: dropzone 
Html :: customize appearance of up/down arrows in html number inputs 
Html :: How to include two pictures side by side in Markdown for Jupyter Notebook 
Html :: clearing dist in parcel 
Html :: ml-auto not working 
Html :: Select with checl box 
Html :: how to add an email box in html 
Html :: a tag in html 
Html :: how to style a form control label 
Html :: popup 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =