Uploading a large file without storing it in memory

I need to upload a large video to a web server, along with some other parameters as a POST. This file is large, and on mobile devices is causing an out of memory exception at the step

Form.AddBinaryData(“file”, File.ReadAllBytes(“foo”));

as the entire file has to be loaded in memory for the upload

is there any way to avoid this and instead stream the file from the internal storage?

I would open the file using a FileStream object, create a buffer of an acceptable size for the target device and copy the data into the buffer. Once the buffer is established begin writing the the server and use the open filestream to keep the buffer full until all of the data is sent. You can find the FileStream information at FileStream Class (System.IO) | Microsoft Learn