-
Notifications
You must be signed in to change notification settings - Fork 94
Description
if I want upload a mov(2G size) to server, use API :
public RequestBuilder Upload(NamedFileStream[] files, object parameters, Action<long,long?> onProgressChanged, Action onUploadComplete)
however if file bigger than 2G, it will throw outofmemory,
the reason I Think is the memorystream capacity is the maximum of int , int.max=2147483648=2^10 * 2^10* 2^10*2=2G
my code:
long fileLength = 0;
var myMD5 = MD5Encrypt.GetMD5HashFromFile(dlg.FileName,out fileLength);
Http.Post(textBox1.Text).Upload(new[] { new NamedFileStream("file", dlg.FileName, "application/octet-stream", File.OpenRead(dlg.FileName)) }, new { md5 = myMD5, size = fileLength }, (bytesSent, totalBytes) =>
{
UpdateText(bytesSent.ToString());
}, (totalBytes) => { })
.OnSuccess((result) => { UpdateText("Completed"); })
.OnFail((result) => { UpdateText(result.Message); })
.Go();