I'm trying to set up an FTP Upload and Download routine in my application.
I've not used the INET control before so am not familiar with the commands etc.
I'm trying to do this without any GUI other than a command button firstly as an example.
The following code doesn't work and am pulling my hair out.
The Upload function is extremely important, more so than the Download.
The files will be Images, uploaded to a known Server and path.
Can anyone help in this ??
Option Explicit
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
Private Sub Command1_Click()
UploadFile "IP#.##.###.###", "MyUserName", "MyPassWord", "L:\MMPDF\Image\99999-91.jpg", "L:\MMPDF\Image\99999-91.jpg"
End Sub
Ip,User & Password changed for site security.
I've not used the INET control before so am not familiar with the commands etc.
I'm trying to do this without any GUI other than a command button firstly as an example.
The following code doesn't work and am pulling my hair out.
The Upload function is extremely important, more so than the Download.
The files will be Images, uploaded to a known Server and path.
Can anyone help in this ??
Option Explicit
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
Private Sub Command1_Click()
UploadFile "IP#.##.###.###", "MyUserName", "MyPassWord", "L:\MMPDF\Image\99999-91.jpg", "L:\MMPDF\Image\99999-91.jpg"
End Sub
Ip,User & Password changed for site security.