I do not understand why this code is not working I am new to coding in javascript and I can't figure out the filereader.
var reader = new FileReader();
reader.onload = function {
var data = reader.result;
alert(data);
};
reader.readAsText("file:///C:/test.txt");
simply put, you cannot access the clients Filesystem with javascript. it's a security measure. you can't use the file
protocol.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.