Created
June 7, 2012 17:03
-
-
Save mps/2890074 to your computer and use it in GitHub Desktop.
Mono File Upload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void UploadFile () | |
{ | |
var uri = new Uri ("http://my_file_upload_handler.com"); | |
var client = new WebClient (); | |
client.UploadFileCompleted += UploadComplete; | |
client.UploadFileAsync(uri, "local_file.png"); | |
} | |
public void UploadComplete (object sender, UploadFileCompletedEventArgs args) | |
{ | |
// Handle the completed event to display success or error on upload to the user. | |
var message = "Upload Complete!"; | |
if (args.Error != null) { | |
message = "Upload Failed, try again!"; | |
// Maybe log the error somewhere for future debugging | |
} | |
// Show an error or success alert to the user. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment