summaryrefslogtreecommitdiffstats
path: root/samples/OAuthConsumer/Twitter.aspx.cs
diff options
context:
space:
mode:
Diffstat (limited to 'samples/OAuthConsumer/Twitter.aspx.cs')
-rw-r--r--samples/OAuthConsumer/Twitter.aspx.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/samples/OAuthConsumer/Twitter.aspx.cs b/samples/OAuthConsumer/Twitter.aspx.cs
index 9b9eced..f309396 100644
--- a/samples/OAuthConsumer/Twitter.aspx.cs
+++ b/samples/OAuthConsumer/Twitter.aspx.cs
@@ -75,4 +75,20 @@ public partial class Twitter : System.Web.UI.Page {
tableBuilder.Append("</table>");
resultsPlaceholder.Controls.Add(new Literal { Text = tableBuilder.ToString() });
}
+
+ protected void uploadProfilePhotoButton_Click(object sender, EventArgs e) {
+ if (profilePhoto.PostedFile.ContentType == null) {
+ photoUploadedLabel.Visible = true;
+ photoUploadedLabel.Text = "Select a file first.";
+ return;
+ }
+
+ var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, this.TokenManager);
+ XDocument imageResult = TwitterConsumer.UpdateProfileImage(
+ twitter,
+ this.AccessToken,
+ profilePhoto.PostedFile.InputStream,
+ profilePhoto.PostedFile.ContentType);
+ photoUploadedLabel.Visible = true;
+ }
}