/// <summary> /// 上传文件 /// </summary> public static void WriteFileAsync() { string filepatn = @"C:\upload\20180826212900.png"; string uploadpath = uploaddir.ToFileGuidName(filepatn); var res = upyunfig.WriteFileAsync(uploadpath, filepatn.ReadFile(), true).Result; Console.WriteLine(res.Data.ToJson()); }
static void Main(string[] args) { string bucketName = Console.ReadLine(); string username = Console.ReadLine(); string password = Console.ReadLine(); UpYunClient upyun = new UpYunClient(bucketName, username, password); var a = upyun.WriteFileAsync("/test.txt", new byte[] { 3, 5, 6, 222, 33, 99, 21 }, true).Result; Console.WriteLine(a); Console.ReadKey(); }
[Fact] //[Fact(DisplayName = "上传文件")] public void WriteFileAsync() { IsAuthType(); string uploadpath = uploaddir.ToFileGuidName(Filepatn); var res = upyunfig.WriteFileAsync(uploadpath, filebyte, true).Result; ResLog(res, "WriteFileAsync"); Assert.True(res.State); }