I want to read a local file with javascript. I have the following function
$(function() {
console.log("antes de readTextFile");
readTextFile("file:///D:/carlota/eusruveyadmin/manuales/ficheropprueba.txt")
});
function readTextFile(file)
{
console.log("readFile principio");
var rawFile = new XMLHttpRequest();
rawFile.open("GET", file, false);
rawFile.onreadystatechange = function ()
{
if(rawFile.readyState === 4)
{
if(rawFile.status === 200 || rawFile.status == 0)
{
var allText = rawFile.responseText;
console.log("readFile fichero ",allText);
}
}
}
rawFile.send(null);
}
In the console browser I have the following message "denied access"
I checked in the browser my file and I can see the file
How do I have to write the path of file?