UploadController

Hi,
I'm using uploadcontroller in my application with i can upload well.
I'm trying to implement a method that upload a file to return it in xml file like this.
[HttpPost("uploadxml")]
public IActionResult SingleUploadXML(IFormFile file)
{
try
{
string path = string.Empty;
string filename = string.Empty;
// Put your code here
XmlDocument up = new XmlDocument();
if (file.Length > 0)
{
using (MemoryStream ms = new MemoryStream())
{
file.CopyToAsync(ms, CancellationToken.None);
ms.Position = 0;
up.Load(ms);
}
}
return Ok(new { importFile = up });
}
catch (Exception ex)
{
return StatusCode(500, ex.Message);
}
}

But in the UploadComplete method i can't get the content of file.
Could you support me, please ?

Hey @Pascal_Felix,

I would like to kindly remind you that dedicated support is available for paid customers only and for questions related to Radzen products - components, IDE, etc. Please use StackOverflow to look for support for such questions.

Hi @enchev,
For information, I find a solution by using services.AddControllers().AddXmlDataContractSerializerFormatters(); in my StartUp and by add [Produces("application/xml")] tag in my method sign and it works perfectly.
Regards,