日期:2014-05-18 浏览次数:20401 次
function uplond() { var oImg = document.getElementById("mainphoto"); ImgUploadManger.imgView.uploadImg(location.protocol + '//' + location.host + "/", oImg.src, window.location.search, oImg.width, oImg.height); alert('下载成功、存放在D盘根目录下!'); }
[AjaxPro.AjaxMethod] public void uploadImg(string _physicalApplicationPath, string _src, string _search, int _width, int _heigth) { //获取比例图的大小 int width = _width; int height = _heigth; _src = _src.Replace(_physicalApplicationPath, ""); //生成比例图 Images img = new Images(); string src = img.Thumbnail1(Server.MapPath("../") + _src, width, height); string filepath = src; string urlpath = src.Replace(Server.MapPath("../"), ""); string filename = System.IO.Path.GetFileName(filepath); try { //这里是下载 WebClient wc = new WebClient(); wc.DownloadFile(_physicalApplicationPath + urlpath, "d:\\" + filename); wc.Dispose(); } catch (Exception ex) { ClientScript.RegisterStartupScript(typeof(string), "Err", string.Format("<script language='javascript'>alert('{0}');</script>", ex.Message)); return; } }