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