You could simply shell out to the FTP.exe program or you can use the FtpPutFile API function.
VB Code:
Private Declare Function InternetOpen Lib "wininet.dll" _
Alias "InternetOpenA" ( _
ByVal sAgent As String, _
ByVal nAccessType As Long, _
ByVal sProxyName As String, _
ByVal sProxyBypass As String, _
ByVal nFlags As Long) As Long
Private Declare Function InternetConnect _
Lib "wininet.dll" Alias "InternetConnectA" ( _
ByVal hInternetSession As Long, _
ByVal sServerName As String, _
ByVal nServerPort As Integer, _
ByVal sUserName As String, _
ByVal sPassword As String, _
ByVal nService As Long, _
ByVal dwFlags As Long, _
ByVal dwContext As Long) As Long
Private Declare Function InternetCloseHandle _
Lib "wininet.dll" ( _
ByVal hInet As Long) As Integer
Private Declare Function FtpPutFile _
Lib "wininet.dll" Alias "FtpPutFileA" ( _
ByVal hFtpSession As Long, _
ByVal lpszLocalFile As String, _
ByVal lpszRemoteFile As String, _
ByVal dwFlags As Long, _
ByVal dwContext As Long) As Boolean
The steps are to call InternetOpen and with the returned handle call the InternetConnect function. The handle returned by that function is in turn used with the FtpPutFile function. When you're done you need to close the two handles using InternetCloseHandle.
I've attached an article I wrote a few years back that explains these functions in more detail.
I don't have the origional CFtp class I made for that article anymore, but I have an extended version of it . But since you asked so nicely or maybe because of the chance to get this post rated I've post not only that class but a whole project. This project is my File Courier application that comes with my Source Edit program. File Courier is a complete FTP client. You may not redistibute this code or the whole application but you may use the classes in it in your own application. Just look at the project as an implementation of how to use the different classes.
I don't have the origional CFtp class I made for that article anymore, but I have an extended version of it . But since you asked so nicely or maybe because of the chance to get this post rated I've post not only that class but a whole project. This project is my File Courier application that comes with my Source Edit program. File Courier is a complete FTP client. You may not redistibute this code or the whole application but you may use the classes in it in your own application. Just look at the project as an implementation of how to use the different classes.
Cheers,
J
Cross my heart, hope to die, stick a needle in my eye!
hehe I am only intertested in your classes... Thanks alot! I may modify the Classes slightly to suit my personal goals. Hope thats OK, I can post any new changes should you be interested in them.
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)