1

I am using following code to read local file.

request = new (window.ActiveXObject || XMLHttpRequest)("Microsoft.XMLHTTP");
request.open("GET", url, 0);
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.send();
document.write(request.responseText);
return request.responseText;

But it will not work in IE.It throws an error 'Access Denied'.Is there any other way to read local file using java script?

Vitor Canova
  • 3,918
  • 5
  • 31
  • 55
Pankaj
  • 3,131
  • 4
  • 14
  • 22

1 Answers1

1

Is there any other way to read local file using java script?

No, unless explicitly allowed by user using <input type="file">. Then it can be processed using HTML5 File APIs

I can recommend you quite good tutorial on File API.

Ginden
  • 5,149
  • 34
  • 68