获取WEB图片

public string GetJpgFile(string strFileServerPath ,string strReportDir)
        {
            string strPath = "";
            strJpgFileName = "";
            try
            {
                WebClient web = new WebClient();
                //FileServer存放目录
                strPath = strFileServerPath + "\\" + Convert.ToDateTime(DateTime).Year + "\\" + Convert.ToDateTime(DateTime).Month + "\\" + Convert.ToDateTime(DateTime).Day + "\\" + strRegisterNo;
                if (!Directory.Exists(strPath))
                {
                    Directory.CreateDirectory(strPath);
                }

                //下载PDF报表,保存在指定目录
                strJpgFileName = DateTime.Now.ToString("yyyyMMddHHmm") + ".jpg";
                //获取WebService 回传的报告连接地址
                string strHostAdress = strReportDir;
                web.DownloadFile(strHostAdress, strPath + "\\" + strJpgFileName);
                web.Dispose();
            }
            catch (Exception ex)
            {
            }
            return strPath;
        }

猜你喜欢

转载自www.cnblogs.com/6B23/p/12212655.html