I have this code :
var link= document.createElement("a");
link.setAttribute("download",name);
link.href=uri;
link.target="_blank";
document.body.appendChild(link);
link.click();
link.remove();
Here I am passing -
url ="M:/folderfname/filename.xlsx";
name = "filename.xlsx"
I am getting this error:
Not Allowed To Load Local Resource file://M:/folderfname/filename.xlsx
I am not getting how can I resolve this in react. Or is there any alternative to download file ?
Note: this is not about downloading a single file which I can import and download. FileName to download getting generated dynamically.
createElementin React code if you can. Secondly, as the error states, you cannot use local filepaths. Put the file into thepublicfolder of your React app and reference it from there. Like/filename.xlsx