|
-
Jan 16th, 2003, 10:30 PM
#1
Thread Starter
New Member
Serious help needed..PLEASE?????
Please, please, please help me..
I want to use the wininet.dll (api) to DOWNLOAD a file from my ftp server, I can not figure it out, I have tried everything, nothing works.
Here is the code I use to UPLOAD to my ftp server (I replaced private info with X's). It works perfectly, how can I modify it to be able to download files from my server? Here is the code below:
IN A MODULE
Public Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" _
(ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, _
ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Public 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 lService As Long, _
ByVal lFlags As Long, ByVal lContext As Long) As Long
Public 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
Public Declare Function InternetCloseHandle Lib "wininet.dll" _
(ByVal hInet As Long) As Integer
DECLERATION SECTION OF MY FORM
Private Const INTERNET_OPEN_TYPE_PROXY = 3
Private Const INTERNET_INVALID_PORT_NUMBER = 0
Private Const INTERNET_SERVICE_FTP = 1
IN CLICK EVENT OF A COMMAND BUTTON
Dim tHost, tUser, tPass, tPort, LocalFile, RemoteFile As String
tHost = XX.XXX.XX.XXX
tUser = "XXXXXXX"
tPass = "XXXXX"
tPort = "-XXXXX"
LocalFile = App.Path + "\Data\progress.egp"
RemoteFile = "\progress.egp"
mlngSession = InternetOpen("Test Connect", INTERNET_OPEN_TYPE_PROXY, vbNullString, vbNullString, 0)
mlngConnection = InternetConnect(mlngSession, tHost, tPort, tUser, tPass, INTERNET_SERVICE_FTP, 0, 0)
blnResult = FtpPutFile(mlngConnection, LocalFile, RemoteFile, 1, 0)
InternetCloseHandle mlngConnection
Please remember this, I do not understand how it works, I just know it does, how can I modify it to be able to DOWNLOAD a file from my server? Please show me with all the code I will need, please?
I really do need your help.....Please..Please?
Thank You Very Much!
P. David Cunningham CEO/Founder Edge Games & RevalSoft
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|