I have full path of file e.g "D:\File\1.xml" and want to read contents of it in javascript. I tried using File and FileReader API's but no success. Following piece of code I tried.
var path = "D:\File\1.xml";
var file = new File(path); //Doesn't work
var fileReader = new FileReader(file); //filereader expects file object
Can anyone help out how to read local files from file path in javascript or how to create File object successfuly from path. Thanks
<input type="file"/>element, and use the File API to read it then (before the actual upload), but you can't do it given a file path, from the browser. See Reading file contents on the client-side in javascript in various browsers for information on using the upload approach.