I am new in JavaScript.
My index.html uses JavaScript to read file. If the file located in the same directory with index.html or relative to it I can read it successfully. But when the file located up to index.html (../../myfile) JavaScript cannot access it. Is that possible to read the file with standard JavaScript?
perhaps this could help read local files:
function readFile(data, elem, file, index) {
if (!file)
return;
var reader = new FileReader();
reader.onloadend = readFileLoadEnd(data, elem, file, index);
reader.readAsDataURL(file);
}
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.