<script> function convertToBase64(event) { var file = event.target.files[0]; var reader = new FileReader(); reader.onload = function (event) { document.getElementById('text').value = event.target.result; document.getElementById('text').select(); }; reader.readAsDataURL(file); } </script> <input id="file" type="file" onchange="convertToBase64(event)"> <textarea id="text"> </textarea>
You may use it at: ImageToBase64 or directly from here:
See this project on GitHub
No comments:
Post a Comment