Exemple #1
0
        /// <summary>
        /// 上传图片至文件服务器
        /// </summary>
        /// <param name="imgByte"></param>
        /// <param name="showName"></param>
        /// <returns></returns>
        public static string UploadImage(byte[] imgByte, string showName, string fileName)
        {
            HttpWebClient client = new HttpWebClient(CreateSaveUrl(showName));

            client.AttachFile(imgByte, fileName, "id");
            string res = client.GetString();

            return(res);
        }
Exemple #2
0
 /// <summary>
 /// 上传图片至文件服务器
 /// </summary>
 /// <param name="imgByte"></param>
 /// <param name="name"></param>
 public static void UploadImageAsync(byte[] imgByte, string name)
 {
     Task.Factory.StartNew(() =>
     {
         HttpWebClient client = new HttpWebClient(CreateSaveUrl(name));
         client.AttachFile(imgByte, name, "id");
         string res = client.GetString();
     });
 }