Closed ricardoboss closed 3 months ago
Hi @ricardoboss Thanks for using kiota and for reaching out. This is something we originally had not planned for. For reference, the header is written here. https://github.com/microsoft/kiota-abstractions-dotnet/blob/03026f728ac41c3398600d3f7406f7be123a9e46/src/MultipartBody.cs#L116 It should be fairly easy to add an optional parameter for the filename here https://github.com/microsoft/kiota-abstractions-dotnet/blob/03026f728ac41c3398600d3f7406f7be123a9e46/src/MultipartBody.cs#L35
And update the data structures to carry that information around until it comes time to write the body.
Is this something you'd be interested in submitting a pull request for?
Sure, I'll take a look when I got time :)
@baywet I think I found a good solution. Let me know what you think!
Hi there,
I am trying to use
Multipart
andAddOrReplacePart(string, string, Stream)
to upload files to my ASP.NET API. The API is unable to bind the submitted values to anIFormFile
field.After some trial-and-error I found out that it is because the request generated by kiota is missing the
filename
field in theContent-Disposition
header.I had to "hack" it in using this:
Notice the
\"
to hijack the"
from theWriteStringValue
call inMultipartBody
.Do you plan to add support for adding parts with filenames/custom content-disposition values?