图片上传程序问题
using System;using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string name = FileUpload1.FileName;
string size = FileUpload1.PostedFile.ContentLength.ToString();
string type = FileUpload1.PostedFile.ContentType;
string type2 = name.Substring(name.LastIndexOf(".") + 1);
string ipath= Server.MapPath("upimg") + "\\" + name;
string fpath = Server.MapPath("upfile") + "\\" + name;
string wpath = "upimg\\" + name;
if (type2 == "jpg" || type2 == "gif" || type2 == "bmp" || type2 == "png")
{
FileUpload1.SaveAs(ipath);
Image1.ImageUrl = wpath;
Label1.Text = "你传如的文件名是:" + name + "<br>文件夹大小为:" + size + "字节<br>文件类型是:" + type + "<br>后缀名是:" + type2;
}
else
{
Image1.Visible = false;
FileUpload1.SaveAs(fpath);
Label1.Text = "你传如的文件名是:" + name + "<br>文件夹大小为:" + size + "字节<br>文件类型是:" + type + "<br>后缀名是:" + type2;
}
}
}
为什么我运行以后发生错误 未能找到路径,能帮忙解决下吗?