Rest api example for file upload

Hello,
I’m trying to upload a file with REST Api. List file functions well but with Uplaad I get a Bad Request error. Here is the Code C# with which I tried to upload the file

using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(“Bearer”, apikey);
using (var request = new HttpRequestMessage(new HttpMethod(“POST”), “https://api.openai.com/v1/files”))
{
var multipartContent = new MultipartFormDataContent();
var data = File.ReadAllText(filePath);
multipartContent.Add(new StringContent(fileType), “purpose”); // answers
multipartContent.Add(new StringContent(data, Encoding.UTF8, “application/json”), “file”);
request.Content = multipartContent;
var response = httpClient.SendAsync(request).Result;
var status = response.StatusCode;
}

Thank you