我想用 DirectoryInfo(string path) 为目录上传  FileInfo  文件
          但我的 path = {D:\Documents and Settings\Administrator\桌面\picture}
               目录确实是存在的 但.net总是提示 目录路径不正确
我的选择的路径  path  是客户端的
但在服务器端运行   DirectoryInfo(path)  的 Exists  属性 总是为false是不是用  DirectoryInfo(path)  不行啊
  

解决方案 »

  1.   

    该目录的权限是否给了aspnet帐户?
      

  2.   

    都是管理员的权限
      DirectoryInfo 只能用于服务端吗;
      那用什么东东获得客户端的信息呢>
      

  3.   

    人家都说了“我的选择的路径 path 是客户端的”,用服务器端的怎么去操作啊..
      

  4.   

    path = {D:\Documents and Settings\Administrator\桌面\picture}应为:
    path =@"D:\Documents and Settings\Administrator\桌面\picture";
    我觉得!
      

  5.   

    那就写个ActiveX控件去访问吧否则是不可能访问到,要是可以访问到,你还把别人机子里的东西给一窝端了..
      

  6.   

    我不知道你是否做的是winform程序,如果是那么在服务器端你要访问客户端文件路径,对于客户端路径你得用网络路径描述,如\\clientaddress\... 其实你可以在客户端对要上传文件转变成流,然后服务器接受到流后再生成文件 
      

  7.   

    DirectoryInfo是对目录的操作,没有上传的功能吧?
      

  8.   

    @"192.168.14.14\d$\file\tt.exe"看看中不
      

  9.   

    用C #,给你一个传多文件的LZ;
    在前端aspx页面上引用下面JS:
     <script  language="JavaScript">
    var i=2 ;
    var j=0;
    function insert_row()

    i++ ;

    R=tbl.insertRow() ;
    R.id="add"+i;

    C=R.insertCell() ;

    var str = "<input type='file' name='File' id='File"+j+"' style='width:100%'>";
    C.insertAdjacentHTML("beforeEnd",str); C=R.insertCell() ;

    C.innerHTML="<input type='button'  value='删除附件' class='buttoncss' onclick=this.parentElement.parentElement.removeNode(true);>" ;

    j++;


    </script>再在table下的td中搞个超链接引用上面JS中的函数,如:<A onclick="insert_row();" href="#">添加附件</A>
    下面是,CS里面的代码:///'遍历File表单元素
    在web.config文件中,随便设置"PrivateResPath" 的物理路径.   如:<add key="PrivateResPath" value="c:\Upload\PrivateRes\"/>  string filePaths = System.Configuration.ConfigurationSettings.AppSettings["PrivateResPath"].ToString();
      System.Text.StringBuilder strMsg = new System.Text.StringBuilder();
            HttpFileCollection files = HttpContext.Current.Request.Files;
            for (int iFile = 0; iFile < files.Count; iFile++)
                {
                    ///'检查文件扩展名字
                    HttpPostedFile postedFile = files[iFile];
                    string fileName, fileExtension;
                    fileName = System.IO.Path.GetFileName(postedFile.FileName);
                    if (fileName != "")
                    {
                        fileExtension = System.IO.Path.GetExtension(fileName);
                        strMsg.Append("上传的文件类型:" + postedFile.ContentType.ToString() + "<br>");
                        strMsg.Append("客户端文件地址:" + postedFile.FileName + "<br>");
                        strMsg.Append("上传文件的文件名:" + fileName + "<br>");
                        strMsg.Append("上传文件的扩展名:" + fileExtension + "<br><hr>");
                        ///'可根据扩展名字的不同保存到不同的文件夹
                        ///注意:可能要修改你的文件夹的匿名写入权限。
                        //postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("images/") + fileName);
                        postedFile.SaveAs(filePaths + fileName);
                    }  
                } 你研究下吧
      

  10.   

    或者
    path = {D:\\Documents and Settings\\Administrator\\桌面\\picture}