UploadFTP




Private Sub cmdUpload_Click()
Dim host_name As String

Enabled = False
MousePointer = vbHourglass
txtResults.Text = "Working"
txtResults.SelStart = Len(txtResults.Text)
DoEvents

' You must set the URL before the user name and

' password. Otherwise the control cannot verify

' the user name and password and you get the error:

' Unable to connect to remote host


host_name = txtHost.Text
If LCase$(Left$(host_name, 6)) <> "ftp://" Then _
host_name = "ftp://" & host_name

inetFTP.URL = host_name
inetFTP.UserName = txtUserName.Text
inetFTP.Password = txtPassword.Text

' Do not include the host name here. That will make

' the control try to use its default user name and

' password and you'll get the error again.


inetFTP.Execute , "Put " & _
txtLocalFile.Text & " " & txtRemoteFile.Text
End Sub











( uploadftp.html )- by Paolo Puglisi - Modifica del 17/12/2023