Upload file - C# - Bad Request - https://api.openai.com/v1/files

Please, could you help?
I have the following problem.
I want to use Upload file.
POST v1/files
I tested it on Postman and it works correctly.
But on the C# endpoint it doesn’t work and displays the Bad Request error.
Below is the source code.

            ep.MapPost("/file", async (IFormFile file) =>
            {
                using (HttpClient client = new HttpClient())
                using (Stream fileStream = file.OpenReadStream())
                using (StreamContent fileContent = new StreamContent(fileStream))
                using (MultipartFormDataContent content = new MultipartFormDataContent())
                {
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", chatGptApiKey);

                    fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data");

                    Dictionary<string, string> postParameters = new Dictionary<string, string>();
                    postParameters.Add("purpose", "assistants");

                    var formContent = new FormUrlEncodedContent(postParameters);
                    content.Add(formContent);

                    content.Add(fileContent);

                    var response = client.PostAsync(chatGptUrl + "/files", content).Result;

                    if (response.IsSuccessStatusCode)
                    {
                        var responseString = await response.Content.ReadFromJsonAsync<ChatGPTFile>();

                        return TypedResults.Ok(responseString);
                    }
                    else
                    {
                        return Results.BadRequest("Erro ao chamar a API");
                    }
                }

            })

Tanks.

The solution is …

ep.MapPost("/file", async (IFormFile file) =>
{
    using (HttpClient client = new HttpClient())
    using (Stream fileStream = file.OpenReadStream())
    using (MemoryStream ms = new MemoryStream())
    using (StreamContent fileContent = new StreamContent(fileStream))
    using (MultipartFormDataContent content = new MultipartFormDataContent())
    {
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", chatGptApiKey);
        client.DefaultRequestHeaders.Host = "api.openai.com";

        fileStream.CopyTo(ms);
        byte[] paramFileStream = ms.ToArray();
        HttpContent bytesContent = new ByteArrayContent(paramFileStream);
        content.Add(new StringContent("assistants"), "purpose");
        content.Add(bytesContent, "file", file.FileName);

        var response = client.PostAsync(chatGptUrl + "/files", content).Result;

        if (response.IsSuccessStatusCode)
        {
            var responseString = await response.Content.ReadFromJsonAsync<ChatGPTFile>();

            return TypedResults.Ok(responseString);
        }
        else
        {
            return Results.BadRequest("Erro ao chamar a API");
        }
    }
}).WithName("UploadFile").DisableAntiforgery().AllowAnonymous();
public class ChatGPTFileRequest
{
    public MultipartFormDataContent file { get; set; }
    public string purpose { get; set; } = "assistants";
}