Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

read/download file using local absolute path

I have one file which is stored at D:/home/abc.pdf locally. I have to read this file using AngularJs

var path="D:/home/abc.pdf";
var doc = document.createElement("a");
doc.href = path;
doc.download = path;
doc.click();
window.URL.revokeObjectURL(path);

I am not able to download this file.Giving error like Failed-Network error enter image description here

like image 428
Gitaram Kanawade Avatar asked Sep 07 '17 05:09

Gitaram Kanawade


1 Answers

That is impossible since local files are protected. Else you would be able to manipulate the hard drive as you wanted just by running a local HTML page.

So : if you want to get a file from the computer's hard drive, you have to use an <input> field and ask the user to upload the file using it.

like image 85
ClementNerma Avatar answered Oct 19 '22 08:10

ClementNerma