比如要下载ftp服务器上的某个文件,在使用internet transfer控件的execute "get file1 file2"的方法时,需要知道file1在服务器上的绝对路径吗?
我已经用cd命令到了文件所在目录,然后get时internet transfer总是返回状态码11,无法连接!
(我登录ftp的id是有下载权限的)

解决方案 »

  1.   

    需要知道file1在服务器上的绝对路径吗?
    不需要Private Sub Command1_Click()  Dim StrMsg As String
      Dim isbusy As Boolean
      
      Inet1.URL = "ftp://192.168.0.1/"
      Inet1.Protocol = icFTP
      Inet1.UserName = ""
      Inet1.Password = ""
        StrMsg = "Dir"
      Inet1.Execute , StrMsg
    end subPrivate Sub Command2_Click()
    Inet1.Execute , "Get 2.zip C:\234.zip"
    end sub
      

  2.   

    但是为什么我执行Inet1.Execute , "Get abc.zip C:\xyz.zip"会返回11呢?
    那个abc.zip不在根目录下有关系吗?比如ftp server目录如下:
    .
    ..
    [2004.07.08 backup-directory 01]
    [2004.07.09 backup-directory 02]而那个abc.zip在[2004.07.09 backup-directory 02]里面,我的vb代码是这样:
    先登录ftp,成功后执行:Inet1.Execute "", "cd [2004.07.09 backup-directory 02]"
    然后等inet1空闲后执行:Inet1.Execute "", "get abc.zip c:\xyz.zip"
    这时候文件没下载下来,inet1最后返回的state是11
      

  3.   

    直接指明路径即可:
    Option ExplicitPrivate Sub Command1_Click()  Dim StrMsg As String
      Dim isbusy As Boolean
      
      Inet1.URL = "ftp://192.168.6.2"
      Inet1.Protocol = icFTP
      Inet1.UserName = "mc"
      Inet1.Password = "vdfrtewrq"
      Inet1.Execute , "Get \mc\vbapi.chm C:\vbapi2.chm"
      
    End Sub