关于“未将对象引用设置到对象的实例”的错误
上传一个文件
提交后到下一个页面接收上传
private void Page_Load(object sender, System.EventArgs e)
{
if (Request.Files.Count > 0)
{
string sXMLPath = Server.MapPath("./") + "upload.xml" ;
System.Xml.XmlDocument oXMLDoc = new System.Xml.XmlDocument() ;
oXMLDoc.Load(sXMLPath) ;
System.Xml.XmlNode oNode = oXMLDoc.SelectSingleNode("/FCKeditor_Upload/FileNameCounter") ;
int iCounter = int.Parse( oNode.InnerText ) + 1 ;
oNode.InnerText = iCounter.ToString() ;
oXMLDoc.Save(sXMLPath) ;
oNode = null ;
oXMLDoc = null ;
System.Web.HttpPostedFile oFile = Request.Files.Get("FCKeditor_File") ;
Label1.Text = oFile.FileName; 总是提示这行“未将对象引用设置到对象的实例”
//string sFileURL = "/UserImages/" + iCounter.ToString().PadLeft(8,'0') + System.IO.Path.GetExtension(oFile.FileName) ;
//string sFilePath = Server.MapPath(sFileURL) ;
//oFile.SaveAs(sFilePath) ;
//Response.Write("<SCRIPT language=javascript>window.opener.setImage('" + sFileURL + "') ; window.close();</" + "SCRIPT>") ;
}
}