如何在用户保存图像时更改图像名称?

时间:2016-02-02 06:12:57

标签: html asp.net browser

如何在用户保存图片时将图片名称更改为网站网址(将图片另存为),如此网站:

Simple Desktop Website

例如图片的名称是: man.png

但是当用户保存时,图片名称将更改为 mysite.com.png

1 个答案:

答案 0 :(得分:0)

这只是为了您的理解

                string _strName = "mysite.com.png";

                System.Web.HttpResponse _response = System.Web.HttpContext.Current.Response;
                _response.ClearContent();
                _response.Clear();
                _response.ContentType = "text/plain";
                _response.AddHeader("Content-Disposition", "attachment; filename=" + _strName + ";");
                _response.TransmitFile(Server.MapPath("Img\\zentree_1.png")); //location of your Image file 
                _response.Flush();
                _response.End();

如果这不是您的期望,那么请回复您的代码, 我相信我可以帮助你。