cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 

UploadAsync fails with small files > 100K and < 1MB

Mario B.17 New member | Level 1
New member | Level 1

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)

3 Replies 3

Re: UploadAsync fails with small files > 100K and < 1MB

Dropboxer
Dropboxer

Thanks for the report! We're taking a look.

Re: UploadAsync fails with small files > 100K and < 1MB

Dropboxer
Dropboxer

Hi Mario, I can't seem to reproduce this. Have you tried it from a different network connection? There might be something on your connection (e.g., proxy, anti-virus, firewall, etc.) that is interfering.

Also, in the title, you said it fails for files "> 100K and < 1MB". You said it works for small files, but does it also work reliably for files >1 MB?

Re: UploadAsync fails with small files > 100K and < 1MB

Mario B.17 New member | Level 1
New member | Level 1

Hi Gregory, thanks for the quick reply.

If failed for any files > 100K; sorry my title wasn't clear, by  < 1MB I meant I wasn't testing with files larger than 1MB.

As for the proxy, anti-virus, etc.  I tried it on my 2nd internet connection (should have thought of that in the first place) and everything seems to work well!  Unfortunately I'm no export when it comes to routers, etc., so I'm not sure why the modem of my main internet connections fails like that.

I'll try to look into this and will post my findings.

Thanks again for your help, much appreciated!
Mario

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?