maybe some additional headers in the HttpClient object are required. Try maybe adding this:
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Add("Accept", "application/json;odata=nometadata");
client.DefaultRequestHeaders.Add("binaryStringRequestBody", "true");
client.DefaultRequestHeaders.Add("X-RequestDigest", tFormDigest.Result.FormDigestValue);
client.MaxResponseContentBufferSize = 2147483647;
Also instead of using MultipartFormDataContent You could try just sending ByteArray with a PostAsync
Something more or less like this for Your case
var endpointUrl = string.Format("{0}/_api/web/getfolderbyserverrelativeurl(\'{1}\')/Files/add(url=\'{2}\',overwrite=true)", sharePointUrl, folderUrl, fileNameNotFullPAth);
using (var handler = new HttpClientHandler { Credentials = new NetworkCredential("codey", "codey123") })
using (var client = new HttpClient(handler))
{
ByteArrayContent content = new ByteArrayContent(new MemoryStream(System.IO.File.ReadAllBytes(filePath)).ToArray());
HttpResponseMessage response = await client.PostAsync(endpointUrl, content).ConfigureAwait(false);
}
Also... did You consider using CSOM? maybe it would be a better approach since You are already using C#.
for on-prem (2013.. but there is for all versions also) You have
https://www.nuget.org/packages/Microsoft.SharePoint2013.CSOM/
and for online
https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM
UPDATE
I added this nuget to some simple c# console app (so the same as from the link)

and the preferred code used for small files under 2MB is
class Program
{
static void Main(string[] args)
{
try
{
Console.WriteLine("start");
byte[] b = System.IO.File.ReadAllBytes(@"[PATH TO FILE LIKE C:\test.png]");
using (ClientContext context = new ClientContext("[SITECOLLECTION URL]"))
{
List list = context.Web.Lists.GetByTitle("[LIB NAME LIKE 'DOCUMENTS']");
FileCreationInformation fileInfo = new FileCreationInformation();
fileInfo.Content = b;
fileInfo.Overwrite = true;
fileInfo.Url = "[SITECOLLECTION URL]" + "/[LIB NAME FROM URL LIKE 'DOCUMENTS']/" + "[FILE NAME LIKE 'test.png']";
Microsoft.SharePoint.Client.File uploadFile = list.RootFolder.Files.Add(fileInfo);
uploadFile.ListItemAllFields.Update();
context.ExecuteQuery();
}
Console.WriteLine("end");
}
catch (Exception ex)
{
Console.WriteLine("error -> " + ex.Message);
}
finally
{
Console.ReadLine();
}
}
}
the code for larger files under 2GB (for SP2013) is (I tested for a file that had around 100MB)
class Program
{
static void Main(string[] args)
{
try
{
Console.WriteLine("start");
using (ClientContext context = new ClientContext("[SITECOLLECTION URL]"))
{
using (FileStream fs = new FileStream(@"[PATH TO FILE LIKE C:\test.png]", FileMode.Open))
{
Microsoft.SharePoint.Client.File.SaveBinaryDirect(context, "/[LIB NAME FROM URL LIKE 'DOCUMENTS']/" + "[FILE NAME LIKE 'test.png']", fs, true);
}
}
Console.WriteLine("end");
}
catch (Exception ex)
{
Console.WriteLine("error -> " + ex.Message);
}
finally
{
Console.ReadLine();
}
}
}
please be aware that I tested it just now and all works BUT on SP2016 (but the nuget was for SP2013 and worked all fine), I don't have access to any SP2013 at the moment to check.
Please be aware that If You have versioning activated on this lib the files will be checked out after upload and You will need to check in with another context.ExecuteQuery().
Please be aware that if You want to run this code as a different user (now it will be the same account as current login) You need to define the networkCredentials giving login, password and domain.
UPDATE
please see the result of this method on SP2016 uploading 470MB file (3 min)

BUT I tried the same on SP2013 and the result was not satisfactory... it takes a lot of time and I waited very long (over 2 hours) to upload 0.5GB file, and the upload still didn't finish at the end.
Please be aware in order to extend the upload You have to change:
- upload file size in CA
- add context.RequestTimeout = -1; to CSOM code
- set bigger timeout session time on IIS
please refer to link and link (not all of course is needed for CSOM upload)