Replies: 1 comment
-
Maybe this can help you: https://stackoverflow.com/a/55415696/6661314 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Whilst there is documentation which shows how to process a multipart request: https://docs.microsoft.com/en-us/aspnet/core/mvc/models/file-uploads?view=aspnetcore-5.0#upload-large-files-with-streaming
I'd like to respond with a multipart (form-data) response, and I can't see how to achieve this.
Ideally the framework would provide an
IActionResult
implementation for responding with a multipart form-data response, or some documentation on how to do that correctly?My use case is this:
I have a web api for uploading multiple files in a multipart request.
If an error is encountered processing any single section (file upload) of that multipart request - I want to capture the error details, and continue to process the next multipart section (file upload).
At the end, I wish to return a response to the caller that encapsulates the results for each individual file upload. I know I could return a single (non multipart) response with a Body containing some object which summarises this, but I'd rather return a multipart response, where each section on that response correlates to a section from the request, and the section in the response would contain a JSON payload (form-data content disposition) indicating whether the particular file upload from the request was a success or failure. The position of the sections in the response correlate with the positions of the sections in the request, so the caller can equate which files were uploaded or not.
How can I return this kind of response with an aspnet core
[ApiController]
?Beta Was this translation helpful? Give feedback.
All reactions