首页 新闻 会员 周边

FileUpload为textarea控件增加插入图片功能,IIS6上不显示不正确。

0
[已关闭问题] 关闭于 2009-12-07 18:02

protected void btn_addPicClick(object sender, EventArgs e)
{
txt_content.Value
= txt_content.Value + "http://www.zushangpu.com" + uploadImage();
}

private string uploadImage()
{
try
{
if (fileUpload.FileBytes.Length > 10)
{
string dirName = "/file";
string fileName = dirName + "/" + DateTime.Now.ToString("yyyyMMddHHmmss") + Path.GetExtension(fileUpload.FileName);
string dirPath = Server.MapPath(dirName);
string filePath = Server.MapPath(fileName);
if (!Directory.Exists(dirPath))
Directory.CreateDirectory(dirPath);
fileUpload.SaveAs(filePath);
return fileName;
}
else
{
return null;
}
}
catch
{
return null;
}
}
iis6.0上操作时候,点击插入图片,返回的图片地址为null,只有http://www.zushangpu.com,  

请教,这段代码哪里不兼容iis6.0,导致上传图片失败。

21天后的主页 21天后 | 初学一级 | 园豆:3
提问于:2009-12-07 17:57
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册