This project has moved and is read-only. For the latest updates, please go here.

OnProgressUpload method for UploadPictureAsync

Topics: Developer Forum, User Forum
Nov 11, 2010 at 7:05 PM

I am wanting to upload rather large photos to Flickr. To do so, I am using the UploadPictureAsync method as follows. The method runs fine and photo is uploaded. However, I am using AddHanlder for the OnUpdateProgress, and am not getting a progress report on the upload. I assume this is since it is an async function. Is there a way to track the progress of the upload with UpdatePictureAsync (as in Bytes uploaded)?

myFlickr = new MyFlickr(apiKey, secretKey, tokenKey)
dim results as new System.Action(of FlickrNet.FlickrResults(of String))(AddressOf uploadPhotoComplete)
AddHandler myFlickr.onUploadProgress, AddressOf flickr_UploadProgressHandler
myFlickr.UploadPictureAsync(stream, fileName, title, description, tags, true, true, true, ContentType.Photo, SafetyLevel.Safe, HiddenFromSearch.Visible, results)

My flickr_UploadProgressHandler code is as follows. I placed a breakpoint on the first line to test if the function was being called.

Private Sub flickr_UploadProgressHandler(ByVal s as Object, ByVal e As FlickrNet.UploadProgressEventArgs)

     Dispatcher.BeginInvoke(New DispatcherDelegate(AddressOf messageReport), Convert.ToInt32(e.Bytes/1000)) <<BREAKPOINT THIS LINE

End Sub

Thanks in advance.

Nov 11, 2010 at 7:48 PM

Unfortunately there is no way in the .Net framework to report on the progress of an async web transfer, so I am unable to raise this event for async uploads.

Nov 13, 2010 at 7:35 AM

Thanks you for your quick response.