![]() |
#2
小瘪三的烦恼2008-09-22 09:10
|

private void ImageUpload()
{
DBOperation dbo = new DBOperation();
pageFunction func = new pageFunction();
string path = this.imageUpload.PostedFile.FileName;
FileInfo image = new FileInfo(path);
string name = image.Name;
string type = image.Extension;
if (".png" == type || ".PNG" == type || ".jpg" == type || ".JPG" == type || ".gif" == type || ".GIF" == type)
{
string savepath = Server.MapPath("Upload");
this.imageUpload.SaveAs(savepath + "\\" + name);
string dbpath = "../BgPage/Upload/" + name;
dbo.InsertImage(dbpath);
string insText = "
";
this.editArea.Text = this.editArea.Text + insText;
func.WriteScipt(this.Page, "alert('上传成功!')");
}
else
{
func.WriteScipt(this.Page, "alert('不支持该图片类型,请选择gif、png或jpg类型的图片!')");
}
}
{
DBOperation dbo = new DBOperation();
pageFunction func = new pageFunction();
string path = this.imageUpload.PostedFile.FileName;
FileInfo image = new FileInfo(path);
string name = image.Name;
string type = image.Extension;
if (".png" == type || ".PNG" == type || ".jpg" == type || ".JPG" == type || ".gif" == type || ".GIF" == type)
{
string savepath = Server.MapPath("Upload");
this.imageUpload.SaveAs(savepath + "\\" + name);
string dbpath = "../BgPage/Upload/" + name;
dbo.InsertImage(dbpath);
string insText = "
this.editArea.Text = this.editArea.Text + insText;
func.WriteScipt(this.Page, "alert('上传成功!')");
}
else
{
func.WriteScipt(this.Page, "alert('不支持该图片类型,请选择gif、png或jpg类型的图片!')");
}
}
我调试的时候,错误提示是在
string path = this.imageUpload.PostedFile.FileName;
获取完整路径有问题,但是从代码上看我实在找不出错在什么地方
获取完整路径有问题,但是从代码上看我实在找不出错在什么地方
有哪位高手知道怎么解决的,拜托指点一下,谢谢