帮忙看看这段代码
if (this.fulFile.PostedFile.FileName.Length==0)
        {
            MessageBox.Show(this,"请选择要上传的公文!");
        }
        else
        {
            if (Request.Files[0].ContentType=="application/msword")
            {
                string fileName = this.fulFile.PostedFile.FileName.ToString();
                int index = fileName.LastIndexOf(".");
                string name = fileName.Substring(index);
                string onLineName = DateTime.Now.Second.ToString() + "_" + this.fulFile.PostedFile.ContentLength + name;  //这段代码报错 说是找不到路径
                if (fileName.Length!=null)
                {
                    this.fulFile.PostedFile.SaveAs(Server.MapPath("Document/" + onLineName));
                }
                
                MessageBox.Show(this, "上传成功!");
            }
            else
            {
                MessageBox.Show(this, "上传的文件只能为Word文件!");
            }
        }
大家帮帮忙 我解决了半天了解决不了 谢了

解决方案 »

  1.   

    这2句错了吧。 
    int index = fileName.LastIndexOf(".");   这个你想取什么?  一个日期 然后定义为图片名么?
                    string name = fileName.Substring(index); 
    导致你后面的错了... 
    取出文件名就可以上传了
    string file = fileName.LastIndexOf("\\")+1; 
    fulFile.PostedFile.SaveAs(Server.MapPath("Document/" + file));                 
      

  2.   

    未能找到路径“C:\Documents and Settings\lenovo\桌面\Oa\MyOaSystem\MyOaSystem\Officer\Document\复件 通告的写作模板.doc”的一部分。 
    这是报出来的错误