I would like to read a file without a tag <input type="file" /> ( I have the path ex. c:\temp\file.txt ) and encode to base64 can anybody help me.
function retornabase64(nomArq) {
var sPathh = '<%=sCaminhoArquivo%>'; //path: c:\temp\temp.txt
var file = sCaminho + "\\" + nomArq;
var reader = new FileReader();
reader.onload = function () {
base64String = reader.result.replace("data:", "")
.replace(/^.+,/, "");
imageBase64Stringsep = base64String;
}
reader.readAsDataURL(file);
console.log('BaseLog: ',base64String);
return base64String;
}