[frontend] Use content-disposition: form-data for file uploads
This commit is contained in:
parent
c0aaa23e92
commit
86cc2986c3
1 changed files with 5 additions and 3 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue