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,导致上传图片失败。