WWW post consumes over 2GB of memory

I’m trying to send a 60MB file up to my web server. I’m doing this by reading the file, serializing it, adding it to a WWWForm, and then using WWW to make the post:

private IEnumerable SendFile(String url, String path)
{
	String fileContents = System.IO.File.ReadAllText(path);

	WWWForm form = new WWWForm();
	form.AddField("FileContents", fileContents);

	using (WWW www = new WWW(url, form))
	{
		yield return www;

		if (www.error == null)
		{
			Debug.Log("Upload successful");
		}
		else
		{
			Debug.Log(www.error);
		}
	}
}

This works fine for smaller files, but for my 60MB file, Unity’s memory usage shoots up to 2.6GB (from a few hundred megabytes), which sometimes causes an OutOfMemoryException to be thrown.

Why would a 60MB file consume 2.6GB of memory, and is there a better way that I could be sending this data?

Thank you.

As far as I know, there is a limit for posting data in http form. It’s not the limit of Unity. It’s about http protocol. On web development, mostly we have to use PUT request for uploading big files instead of POST requests. You can get the basic idea how http works here : What's the difference between a POST and a PUT HTTP REQUEST? - Stack Overflow

Unity WWW class doesn’t support PUT request. You should implement your own logic using .NET WWW class, WebRequest Class (System.Net) | Microsoft Learn