your angular code can not write to the file system except via local storage. the most common trick to save a blob, is to convert it to a data url, and assign as the href of an anchor. then javascript can cll the click event. (requires browser support data
url navigation).
the other common approach is anchor navigation or a browser form post to target="_blank", and the server return the file as an attachment.
let a = document.getElementById('downloader');
if (!a) {
a = document.createElement('a');
a.id = 'downloader';
a.target = '_blank';
a.style.visibility = "hidden";
document.body.appendChild(a);
}
a.href = 'https://localhost:44396/api/ApprovalQuality/download?fileName=' + input;
a.click();
Member
38 Points
350 Posts
How to download Excel template file from folder attachment using angular 7?
Nov 23, 2020 02:23 AM|ahmedbarbary|LINK
I work on project angular 7 and web API asp.net core 2.2 I face issue I can't get Template Excel file
Exist on Server found on folder Attachment and file Name Delivery.xlsx to download it .
I only Need When click on download Button download Template Excel file from folder attachment
my issue How to get file Delivery.xlsx from attachment Folder and assign it on angular 7 to download ?
All-Star
57844 Points
15487 Posts
Re: How to download Excel template file from folder attachment using angular 7?
Nov 23, 2020 05:01 PM|bruce (sqlwork.com)|LINK
your angular code can not write to the file system except via local storage. the most common trick to save a blob, is to convert it to a data url, and assign as the href of an anchor. then javascript can cll the click event. (requires browser support data url navigation).
the other common approach is anchor navigation or a browser form post to target="_blank", and the server return the file as an attachment.
-- bruce