Skip to content

Instantly share code, notes, and snippets.

@xdumaine
Created March 31, 2014 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xdumaine/9900469 to your computer and use it in GitHub Desktop.
Save xdumaine/9900469 to your computer and use it in GitHub Desktop.
var uri = new Uri(API_URL_MEDIA);
var content = new MultipartFormDataContent();
content.Add(new StringContent(caption), ""caption"");
var t = new StreamContent(photoContents);
t.Headers.ContentType
= new System.Net.Http.Headers.MediaTypeHeaderValue(contentType);
fileName = string.IsNullOrEmpty(fileName) ? ""img.png"" : fileName;
content.Add(t, ""media"", """ + fileName + """);
var response = PostBuffer(uri, content);
response.EnsureSuccessStatusCode();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment