Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript convert image to base64

function encodeImageFileAsURL(element) {
  var file = element.files[0];
  var reader = new FileReader();
  reader.onloadend = function() {
    console.log('RESULT', reader.result)
  }
  reader.readAsDataURL(file);
}
<input type="file" onchange="encodeImageFileAsURL(this)" />
Comment

PREVIOUS NEXT
Code Example
Javascript :: make copy of date javascript 
Javascript :: js get class property 
Javascript :: make text lowercase javascript 
Javascript :: tinymce update textarea value using jquery 
Javascript :: click counter in js 
Javascript :: javascript variable with multiline text 
Javascript :: js looping through array 
Javascript :: react read multiple files with filereader 
Javascript :: how to access dictionary keys in js 
Javascript :: javaScript setSeconds() Method 
Javascript :: node app 
Javascript :: define an unsigned int js 
Javascript :: jquery find index of this 
Javascript :: reactsj substring 
Javascript :: javascript tofixed no trailing zeros 
Javascript :: comparing two arrays in javascript returning differences 
Javascript :: javascript onclick button 
Javascript :: Passing components as children in react 
Javascript :: how to convert name to initials in javascript 
Javascript :: javascript check for null variables 
Javascript :: ajax select2 
Javascript :: how to set the development mode in webpack 
Javascript :: closure in js 
Javascript :: react render after data loaded 
Javascript :: for in loop key 
Javascript :: how to return a factorial in javascript 
Javascript :: js class exists 
Javascript :: detect click outside react component 
Javascript :: assign array to another array javascript 
Javascript :: use get_json in jstree example 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =