[frontend] Use content-disposition: form-data for file uploads

This commit is contained in:
Laura Hausmann 2024-04-22 19:02:24 +02:00
parent c0aaa23e92
commit 86cc2986c3
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -83,16 +83,18 @@ internal class ApiClient(HttpClient client)
if (data is IBrowserFile file) if (data is IBrowserFile file)
{ {
request.Content = new MultipartContent request.Content = new MultipartFormDataContent
{ {
new StreamContent(file.OpenReadStream()) new StreamContent(file.OpenReadStream())
{ {
Headers = Headers =
{ {
ContentType = new MediaTypeHeaderValue(file.ContentType), ContentType = new MediaTypeHeaderValue(file.ContentType),
ContentDisposition = new ContentDispositionHeaderValue("attachment") ContentDisposition = new ContentDispositionHeaderValue("form-data")
{ {
FileName = file.Name, Size = file.Size Name = "file",
FileName = file.Name,
Size = file.Size
} }
} }
} }