Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript base64 encode file input

var fileInput = document.getElementById('#myInputID');

var reader = new FileReader();
reader.readAsDataURL(fileInput.files[0]);

reader.onload = function () {
	console.log(reader.result);//base64encoded string
};
reader.onerror = function (error) {
	console.log('Error: ', error);
};
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #encode #file #input
ADD COMMENT
Topic
Name
1+4 =