Suggested timeout .NET SDK UploadUsingSessionAsync
Hi,
We have a c# app that uses the .NET SDK, and UploadUsingSessionAsync and UploadAsync (UploadAsync speed is ok as files are not too big)
Works OK, but could be a lot quicker. (browser uploads are very fast)
I can't find any documentation to suggest what value (if any) we should use for timeout.
I wonder if using null is not ideal.
Here is our upload code;
if (!string.IsNullOrEmpty(SourceFileName))
{
using (var file = File.OpenRead(SourceFileName))
{
Logger.Log.AddToLog(string.Format("going to upload file: {0}", SourceFileName));
var fileName = System.IO.Path.GetFileName(SourceFileName);
var progress = new Progress(val =>
{
Console.WriteLine("{0}%", val.progress);
CurrentProgress = val.progress;
Logger.Log.AddToLog(string.Format("uploading progress: {0}%", val.progress));
});
BoxFile bFile;
if (file.Length > 20 * 1024 * 1024)
{
bFile = await userClient.FilesManager.UploadUsingSessionAsync(file, fileName, jobFolder.Id, null, progress);
}
else
{
BoxFileRequest uploadRequest = new BoxFileRequest()
{
Name = fileName,
Parent = new BoxFolderRequest { Id = jobFolder.Id }
};
bFile = await userClient.FilesManager.UploadAsync(uploadRequest, file);
}
Logger.Log.AddToLog(string.Format("uploading done: {0}", SourceFileName));
Please sign in to leave a comment.
Comments
0 comments