Hi,
I used the sample code for UploadAsync() method, in VB.Net, VS 2015, .Net 4.5, API v3.1.2, and for very small files it works perfectly. However for somewhat larger files, ie 151K it never works.
I also tried the sample code that uses UploadSessionStartAsync, UploadSessionAppendAsyncV2 and UploadSessionFinishAsync, with the same file (151K) and I got it to work only once when setting the chunksize to 24 * 1024, but it's extremely slow to upload.
Here's my code for UploadAsync;
Dim t As Files.FileMetadata
Dim fs As New MemoryStream(System.IO.File.ReadAllBytes(file))
Log("Uploading " & file)
Try
t = Await mDBX.Files.UploadAsync("/" & dbFolder & "/" & dbFileName, Files.WriteMode.Overwrite.Instance, False, , True, fs)
Log("File uploaded: UFID = " & t.Id)
Catch ex As Exception
'MsgBox(ex.Message & vbCrLf & ex.StackTrace.ToString, MsgBoxStyle.Critical)
End Try
Any help would be greatly appreciated,
Thanks
Mario
The error I get is:
Error: Error while copying content to a stream.
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Dropbox.Api.DropboxRequestHandler.<RequestJsonString>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Dropbox.Api.DropboxRequestHandler.<RequestJsonStringWithRetry>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Dropbox.Api.DropboxRequestHandler.<Dropbox.Api.Babel.ITransport.SendUploadRequestAsync>d__5`3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at TestDropBox.frmMain.VB$StateMachine_6_UploadFile.MoveNext() in \\vmware-host\shared folders\Documents\Visual Studio 2015\Projects\TestDropBox\TestDropBox\Form1.vb:line 62
Error: Unable to read data from the transport connection: The connection was closed.
at System.Net.ConnectStream.IOError(Exception exception, Boolean willThrow)
at System.Net.ConnectStream.EndWrite(IAsyncResult asyncResult)
at System.Net.Http.StreamToStreamCopy.BufferWrittenCallback(IAsyncResult ar)