Esempio n. 1
0
        public static byte[] UploadMultipart(this WebClient client, string address, MultipartFormBuilder multipart)
        {
            client.Headers.Add(HttpRequestHeader.ContentType, multipart.ContentType);

            using (var stream = multipart.GetStream())
            {
                return(client.UploadData(address, stream.ToArray()));
            }
        }
Esempio n. 2
0
        public static async Task <byte[]> UploadMultipartTaskAsync(this WebClient client, string address, string method, MultipartFormBuilder multipart)
        {
            client.Headers.Add(HttpRequestHeader.ContentType, multipart.ContentType);

            using (var stream = multipart.GetStream())
            {
                return(await client.UploadDataTaskAsync(address, method, stream.ToArray()));
            }
        }