Closed imrandyk closed 6 months ago
I try to configure to multipart/form-data but I don't, Is there way to configure ?
Any news about this problem?
This is an example of working with multipart data when uploading file, if it's not suffice and issue is still relevant please reopen and add new description. Thanks
For binary file upload
[ProducesResponseType(typeof(TestModel), (int)HttpStatusCode.Created)]
[RequestHttpHeader("x-ms-session-id", true)]
[Function("TestUpload")]
[SwaggerUploadFile("Pdf", "Pdf upload")]
public async Task<IActionResult> TestUpload(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "test/upload")] HttpRequest req)
{
var data = await req.ReadFormAsync();
if (data != null)
{
foreach (var formFile in data.Files)
{
using var reader = new StreamReader(formFile.OpenReadStream());
var fileContent = await reader.ReadToEndAsync();
return new OkObjectResult(fileContent.Length);
}
}
return new NoContentResult();
}
If there is a way to support multipart/form-data I'm not seeing? If it is supported how would you accomplish this? If not is there a plan or path to do this?
There is a need to send files as part of the form also.