I work on asp.net core 2.2 Project with angular 7 . I face issue when download file
It created with Name [object FormData].xlsx but Name must be DeliveryGeneration_Output.xlsx .
on Angular 7
- public uploadFile = (files) => {
- const formData = new FormData();
- formData.append('file', this.fileToUpload,this.fileToUpload.name);
- this.http.post('https://localhost:44396/api/ApprovalQuality/', formData,{ responseType: 'blob' })
- .subscribe((response: Blob) => saveAs(response, formData + '.xlsx'));
- }
on Web API .Net Core 2.2
- var memory2 = new MemoryStream();
- using (var stream = new FileStream(exportPath, FileMode.Open))
- {
- stream.CopyTo(memory2);
- }
- memory2.Position = 0;
- return File(memory2, "text/plain", Path.GetFileName(exportPath));
Path returned and Created
\\192.168.2.7\\ImportExport\\2\\Export\DeliveryGeneration_Output.xlsx
so why file name created with [object FormData].xlsx and not created with DeliveryGeneration_Output.xlsx
and How to solve this Issue ?