FTP.RemoteAddress = 地址
FTP.UserName = 用户名
FTP.Password = 密码
FTP.Connect
FTP.LocalFile = 文件本地地址
FTP.RemoteFile = ftp上的地址
On Error Resume Next
FTP.PutFile
If Err <>0 Then
MsgBox "未能连接到远程服务器,请检测网络", vbExclamation, "注意"
Exit Sub
End If
MsgBox "上传成功", , "成功!"
FTP.Disconnect
Private Sub Command1_Click()'下载文件:
Inet1.Execute "", "GET firewall.rsc 文件路径"
ri = Inet1.StillExecuting
Do While ri
ri = Inet1.StillExecuting
DoEvents
Loop
End Sub
Private Sub Command2_Click()
'上传文件:
Inet1.Execute "", "PUT d:\11.xls 11.xls"
ri = Inet1.StillExecuting
Do While ri
ri = Inet1.StillExecuting
DoEvents
Loop
End Sub
Private Sub Form_Load()
Inet1.Protocol = icFTP
Inet1.RemoteHost = "192.168.1.1" '服务器地址
Inet1.RemotePort = 21 'FTP端口
Inet1.UserName = "" '用户名
Inet1.Password = ""
End Sub
这个我测试通过
1.打印ftp控制数据到文件(ftpcmd.scr)--
ftpcmd.scr
--
open
服务器的地址
帐号
密码
bin
文件名
disconnect
bye
2.执行下面vb代码Shell
"cmd.exe
/C
FTP.EXE
-i
-s:ftpcmd.scr"
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)