1
如何使用Visual Basic 6.0將文本文件上傳到我的ftp服務器?通過ftp上傳文件
我想在我的服務器上將「C:\ hello.txt」上傳到「files/hello.txt」。
我以前試過這個代碼,但沒有成功:
Function UploadFile(ByVal HostName As String, _
ByVal UserName As String, _
ByVal Password As String, _
ByVal LocalFileName As String, _
ByVal RemoteFileName As String) As Boolean
Dim FTP As Inet
Set FTP = New Inet
With FTP
.Protocol = icFTP
.RemoteHost = HostName
.UserName = UserName
.Password = Password
.Execute .URL, "Put " + LocalFileName + " " + RemoteFileName
Do While .StillExecuting
DoEvents
Loop
UploadFile = (.ResponseCode = 0)
End With
Set FTP = Nothing
End Function
又是怎麼回事Ftp.url?您從未向您展示過的樣品中分配過它。 「沒有成功」是什麼意思? –
結果如何?你如何調用UploadFile? (你將LocalFileName和RemoteFilename設置爲什麼?你在LocalFileName中包含路徑.ResponseCode的值是什麼? – Hrqls