示例#1
0
        public static async Task UploadFileAsync(string filename, string editToken, bool ignoreWarnings, Upload upload)
        {
            var data = File.ReadAllBytes(filename);

            filename = Path.GetFileName(filename);

            var httpContent = new MultipartFormDataContent();
            httpContent.Add(new StringContent("upload"), "action");
            httpContent.Add(new StringContent(filename), "filename");
            httpContent.Add(new StringContent(editToken), "token");
            if (ignoreWarnings)
                httpContent.Add(new StringContent("true"), "ignorewarnings");
            httpContent.Add(new StringContent("xml"), "format");
            httpContent.Add(new ByteArrayContent(data), "file", filename);

            await upload.Run(httpContent);
        }
示例#2
0
 public static Task UploadFileAsync(string filename, string editToken, Upload upload)
 {
     return UploadFileAsync(filename, editToken, true, upload);
 }