是啊,就因为不知道客户端的磁盘情况,所以才想要用绝对路径找到服务器的txt文件,就是要让所有的客户端都修改服务器端的txt文件,有办法么?

解决方案 »

  1.   

    所以才想要用绝对路径找到服务器的txt文件客户端fso读取的是客户端文件读取服务器文件请使用 ajax
      

  2.   

    能不能大致讲一下,如何使用ajax读服务器文件,本人不是很熟,谢谢
      

  3.   

    fso好象只能操作本地的
    有的网页能打开网页文件并取原码这里最好用ajax,用xmlhttp组件
      

  4.   

    谁能大致给我讲一下啊,怎么用ajax啊,我已经踌躇满志了
    而且谁能告诉我,Scripting.FileSystemObject的打开文件函数,功能描述是说可以用相对路径的,可为什么就不行呢?我换了两台机器试也都不行
      

  5.   

    关键是你用的是客户端控件 不能读取服务器文件关于ajax的参考资料http://baike.baidu.com/view/1641.htm
      

  6.   

    不知道你的具体用途  也可以考虑服务器端fso<%
    function ReadFile(filename)
    on error resume next
    err.clear
    'ASP的一种校错方法
    Const ForReading = 2
    Const Create = false
    Dim FSO
    DIM TS
    DIM filepath
    DIM thefile
    Dim content'---------------操作地址Set FSO=server.createobject("scripting.filesystemobject")
    filepath=server.MapPath("temp") ./记录本存放的文件夹if err.number<>0 then
    response.Write "目录不存在"
    response.End
    end if'filename="test.txt" ---------test.txt为你从数据库里读出的文件名
    thefile=filepath&"/"&filename
    Set TS = FSO.OpenTextFile(thefile,1)do until Ts.AtEndOfStream
    Response.Write (""&TS.ReadLine&"")
    response.write("<br>")
    loopSet TS = Nothing
    Set FSO = Nothing
    end function
    %><%
    dim id
    dim filename
    id=6
    Set rs=Server.CreateObject("ADODB.Recordset")
    sql="select * from yuan where id="&id
    rs.open sql,cn,1,1
    filename=rs("fileload")
    %><% readfile(filename) %>
      

  7.   

    谢谢你的代码,正在读,很感动,但我是想只用html和js脚本,应该如何是好呢
      

  8.   

     我也遇到你类似的问题,好想不好弄,建议搞个临时目录吧
    如: 
     f  =  fso.CreateTextFile("c:\\temp\\testfile.txt",  ForWriting,  true);