upload csv file using httpclient problem
public async Task<Result<string>> UploadCsvFileAsync(byte[] csvData, string fileName,
CancellationToken cancellationToken = default)
{
try
{
var client = _httpClientFactory.CreateClient();
using var content = new MultipartFormDataContent();
var fileContent = new ByteArrayContent(csvData);
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("text/csv");
content.Add(fileContent, "file", fileName);
any idea why this is not working? returning me Unsupported or unrecognized file type.
even thou, if i try it via swagger/postman on the url it actually works.
it expects iformfile, binary format file
string($binary)
0 Replies