This repository has been archived on 2017-12-27. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
ScreenCapture/Web.cs
nyyu dfe251ef99 add recents items list
change from stream to bytes
2015-09-27 13:16:15 +02:00

22 lines
697 B
C#

using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace ScreenCapture
{
static class Web
{
public static async Task<string> upload(byte[] bytes, string fileName)
{
using (HttpClient client = new HttpClient())
using (var content = new MultipartFormDataContent("------Upload" + DateTime.Now.Ticks))
{
content.Add(new ByteArrayContent(bytes), "file", fileName);
using (var message = await client.PostAsync("http://nyyu.tk/sc/api.php", content))
{
return await message.Content.ReadAsStringAsync();
}
}
}
}
}