I work on asp.net core 2.2 web api project with angular 7 .
my issue on when click on upload button
File not download as attachment on browser .
when put break point on api and run angular app it hitted break point and file name can see from api when pass it
I think this is problem of angular 7 because web api return file
on angular 7
- on angular 7
-
- component.ts
- fileToUpload: File = null;
- public uploadFile = (files) => {
-
- const formData = new FormData();
-
- formData.append('file', this.fileToUpload,this.fileToUpload.name);
-
- this.http.post('https://localhost:44396/api/ApprovalQuality/', formData)
-
- .subscribe(data =>{
-
- }, error => {
- console.log(error);
- });
-
- }
- handleFileInput(files: FileList) {
- if (files.length == 0) {
- return;
- }
- this.fileToUpload = files.item(0);
- console.log(this.fileToUpload)
- }
-
- component.html
- <button type="button" class="btn btn-success" (click)="uploadFile(files)">Upload Filebutton>
test api return like that by post man give me 200 Status OK
but on browser no file download as result
when connect angular 7 with api no file returned and no file downloaded
so How to solve issue