请教关于inet控件的问题!

koppi 2010-03-01 08:08:06
URL.Text是ftp://xzdx:123456@192.168.0.20,用xzdx用户登陆linux的默认路径是/home/xzdx,如果不更改linux默认路径,在VB中实现路径的更改,例如转到/home/abc/bin该如何实现,以下是默认路径上传的代码,请大侠们看看应该如何更改路径,谢谢!
Private Sub cmdSend_Click()
Dim myfilepath As String
myfilepath = File1.Path & "\" & File1.FileName
StateStyle = 1
Inet1.Execute URL.Text, "SEND" & myfilepath & " " & File1.FileName
MsgBox "上传已成功!", , "系统提示"
StateStyle = 0
Inet1.AccessType = icUseDefault
Inet1.Protocol = icFTP
Inet1.RemotePort = 21
Inet1.Execute URL.Text,“DIR”
End Sub
...全文
131 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
koppi 2010-04-22
  • 打赏
  • 举报
回复
起~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
koppi 2010-04-01
  • 打赏
  • 举报
回复
测试楼上的,inet不能连续执行两个命令,请大侠们给段成码好吗,谢谢
koppi 2010-03-10
  • 打赏
  • 举报
回复
"get /home/abc/bin/a.txt c:/1/a.txt"可以
"put c:/1/a.txt /home/abc/bin/a.txt " 就不行
求助ing


koppi 2010-03-10
  • 打赏
  • 举报
回复
自己顶一下 求高人解决
赵4老师 2010-03-10
  • 打赏
  • 举报
回复
上帖中
cmd "GET " + filename+" " + App.Path + "\" + vox + ".VOX"
改为
cmd "GET " + filename+" " + App.Path + "\" + filename
赵4老师 2010-03-10
  • 打赏
  • 举报
回复
Private Sub cmd(cmdstr As String)
Do
If Inet1.StillExecuting = False Then Exit Do
Loop
ExeStr = cmdstr
Done = False
Debug.Print ExeStr; "="
Inet1.Execute , ExeStr
Do
DoEvents
If Done Then Exit Do
Loop
End Sub
Public Sub ReadAFile(filename As String)
Inet1.URL = "ftp://xzdx:123456@192.168.0.20"
Inet1.UserName = "xzdx"
Inet1.Password = "*****"

cmd "PWD"
cmd "CD /home/abc/bin"
cmd "LS"
cmd "GET " + filename+" " + App.Path + "\" + vox + ".VOX"
cmd "QUIT"
End Sub

Private Sub Inet1_StateChanged(ByVal State As Integer)
Dim intFile As Integer
Dim vtData() As Byte
Dim str As String
'On Error GoTo ISCerr
Debug.Print "State="; State,
Select Case State
Case 0
Debug.Print "icNone"
Case 1
Debug.Print "icHostResolvingHost"
Case 2
Debug.Print "icHostResolved"
Case 3
Debug.Print "icConnecting"
Case 4
Debug.Print "icConnected"
Case 5
Debug.Print "icRequesting"
Case 6
Debug.Print "icRequestSent"
Case 7
Debug.Print "icReceivingResponse"
Case 8
Debug.Print "icResponseReceived"
If Left(ExeStr, 2) = "CD" Then Done = True
Case 9
Debug.Print "icDisconnecting"
Case 10
Debug.Print "icDisconnected"
Done = True
Case 11
Debug.Print "icError of [" + ExeStr + "]="; Inet1.ResponseInfo
Done = True
Case 12
Debug.Print "icResponseCompleted----------------"
Do
str = Inet1.GetChunk(1024, icString)
If LenB(str) = 0 Then Exit Do
Debug.Print str
Loop
Done = True
End Select
Exit Sub
ISCerr:
Resume Next
End Sub
舉杯邀明月 2010-03-01
  • 打赏
  • 举报
回复
up
koppi 2010-03-01
  • 打赏
  • 举报
回复
麻烦楼上给段代码 谢谢
Tiger_Zhao 2010-03-01
  • 打赏
  • 举报
回复
CD 和 SEND 是两次命令,注意要等到前一个命令成功后再发送下个命令。
koppi 2010-03-01
  • 打赏
  • 举报
回复
Inet1.Execute URL.Text,"CD " & "/home/abc/bin" "SEND" & myfilepath & " " & File1.FileName
这样吗?不行啊
  • 打赏
  • 举报
回复
.Execute , "CD " & "/home/abc/bin"?
bcrun 2010-03-01
  • 打赏
  • 举报
回复
关注!尤其是这种在VB6中访问FTP的:)

1,451

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧