0

I am trying to download file on a link click following this stackoverflow question Angularjs simple file download. After i click the link file downloads with error saying Failed No file. I have checked projects App_Data folder file is present there. Can anyone help figure out the issue.

 <a target="_self" download="{{q.FileName}}" ng-href="{{q.QuizFile}}" href="#">Open File</a>

It renders into this path...

<a target="_self" download="Discussion.docx" ng-href="~/App_Data/74edf10b-5c18-472f-92bb-c64f55575b29/Discussion.docx" href="~/App_Data/74edf10b-5c18-472f-92bb-c64f55575b29/Discussion.docx">Open File</a>
Community
  • 1
  • 1
Salman Shaykh
  • 221
  • 5
  • 16

1 Answers1

2

The tilde in the path name doesn't mean anything in JavaScript. Its a convenience in mvc that resolves server side. Pass the path without the tilde.

Nick Bailey
  • 3,078
  • 2
  • 11
  • 13