头疼--怎么会有这个差别呢
上传图片的程序,但是出现了个怪问题
用绝对路径的时候显示正常
但是用相对路径就不能显示了。 这究竟是为什么列??? 不解
代码如下:请帮我看看啦
string fullName = this.File1.PostedFile.FileName;
string fileName = fullName.Substring(fullName.LastIndexOf("\\")+1);
string type =fullName.Substring(fullName.LastIndexOf(".")+1);
if(type=="jpg"||type=="gif"||type=="bmp")
{
this.File1.PostedFile.SaveAs(Server.MapPath("up")+"\\"+fileName);
//this.Image1.ImageUrl=Server.MapPath("up")+"\\"+fileName;//绝对路径
this.Image1.ImageUrl="up/"+fileName;//相对路径
}
else
{
Response.Write
("<script language='javascript'> alert('你选择的图片格式不正确'); </script>");
}