C# HttpClient 4.5 multipart/form-data upload -


does know how use httpclient in .net 4.5 multipart/form-data upload?

i couldn't find examples on internet.

my result looks this:

public static async task<string> upload(byte[] image) {      using (var client = new httpclient())      {          using (var content =              new multipartformdatacontent("upload----" + datetime.now.tostring(cultureinfo.invariantculture)))          {              content.add(new streamcontent(new memorystream(image)), "bilddatei", "upload.jpg");                using (                  var message =                      await client.postasync("http://www.directupload.net/index.php?mode=upload", content))               {                   var input = await message.content.readasstringasync();                    return !string.isnullorwhitespace(input) ? regex.match(input, @"http://\w*\.directupload\.net/images/\d*/\w*\.[a-z]{3}").value : null;               }           }      } } 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -