string path = Server.MapPath("./");  
中的path值是什么啊?

解决方案 »

  1.   

    把“/”去掉。string path = Server.MapPath(".");
      

  2.   

    即使把path 换掉,如下:
    string  TempFileName;
    TempFileName = "C:\\TempFiles\\";
    MyFileCollection[0].SaveAs(TempFileName);仍然会出现同样的问题!
      

  3.   

    baddot(小不点) ,把“/”去掉。string path = Server.MapPath(".");
    仍然不行,同样的错误!
      

  4.   

    if(Tb_TrunFile.PostedFile == null|| Tb_TrunFile.PostedFile.FileName.Trim().Length == 0)
    {
    images_Message.Text = "请选择要上传的源文件!";
    return ;
    }
     
    HttpPostedFile myFile = Tb_TrunFile.PostedFile;
    string SourFile = Tb_TrunFile.PostedFile.FileName; //返回的是通过文件对话框选择的文件名
    string images_Name = Path.GetFileName(SourFile);//' 去掉目录信息,返回文件名称
    string newext=System.IO.Path.GetExtension(myFile.FileName).ToLower();
    //if((System.IO.Path.GetExtension(myFile.FileName).ToLower() != ".jpg") || (System.IO.Path.GetExtension(myFile.FileName).ToLower() != ".bmp")||(System.IO.Path.GetFileName(myFile.FileName).ToLower() != ".gif"))
    //int i= images_Name.LastIndexOf(".");
    //--获得扩展名
    //string newext =images_Name.Substring(i);
    if(newext.Equals(".jpg")==false && newext.Equals(".bmp")==false &&  newext.Equals(".gif")==false)
    {
    LabelMessage.Text="The file must have an extension of jPG or BMP or GIG";
    return;
    }
    //string DestPath =@"C://Inetpub//wwwroot//center//image//";
    string DestPath=@"D://center_new_spieler_0331//image//";
    string test=DestPath.Trim() + images_Name;
    DestFile[images_news_test]=test;//生成目的文件路径 if(DestFile[images_news_test].Trim().Length == 0)
    {
    images_Message.Text = "请输入要上传的目的文件!";
    return ;
    } if(!Directory.Exists(DestPath))
    {
    Directory.CreateDirectory(DestPath);
    }
    Tb_TrunFile.PostedFile.SaveAs(DestFile[images_news_test]);

    DestFile[images_news_test]=images_Name;
    images_list.Items.Add(DestFile[images_news_test]);
    images_news_test++;
    images_Message.Text="第"+images_news_test+"张图片上传成功";
    }
    catch(Exception ex)
    {
    images_Message.Text=ex.Message+"上传出错";
    }
      

  5.   

    vzxq(灵感人) 能够把你的源文件发过来吗?
    [email protected]谢谢!