Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Can't upload file bigger than 2G #38

@hucongquan

Description

@hucongquan

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,
error_bigger_than_2g

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions