Hello,
I've written a POST method in Web API project.
This POST method looks like
[HttpPost]
[ActionName("downloadfile")]
public System.Web.Mvc.FileContentResult DownloadImportedFile(string id)
{
try
{
byte[] fileContent = ... //some logic to get the file content into byte array
var fileContentResult = new System.Web.Mvc.FileContentResult(Encoding.UTF8.GetBytes(fileContent, "text/xml");
fileContentResult.FileDownloadName = "myFile.xml];
return fileContentResult;
}
}
On the client side, I'm using HTML and AngularJS.
var data = {
JobId: "This_Is_My_Id"
};
$http.post(url, data, config);
The fileContentResult is properly populated with byte array and the POST method returns value perfectly. But on the browser side
save as dialog is not launched.
Please help.
Thanks,
Saswat