I’m using a webclient to upload a relatively large file (40mb) via the UploadFileAsync method.
As I’m testing this on an emulator, the connection speed is quite fast. I can see the UploadProgressChanged is getting called frequently, and reaches 100% within around 20 secs.
However, the UploadFileCompleted doesn’t get called for another 12 minutes!!
If I upload a smaller file (say, 500kb), UploadFileCompleted gets called almost as soon as the upload progress reaches 100%.
I’m wondering if this has something to do with threads? I can’t imagine how, though.
In terms of the web server, it officially receives the file when UploadFileCompleted gets called, and not a minute before. So my other thought is that the UploadProgressChanged is just wrong.
Anyone have any ideas?
Should have looked a bit deeper before posting.
I thought it was odd that the upload happened so quickly. What’s happening is the app is saying ‘upload this!’ and android is saying ‘ok!’.. and it thinks it’s been uploaded. but it just sits in a queue with android.
there is a fix here:
https://bugzilla.xamarin.com/show_bug.cgi?id=3100
Basically, inherit from WebClient and override getwebrequest, and set AllowWriteStreamBuffering to false. Here’s my simple code: