|
-
May 25th, 2009, 03:06 AM
#1
Thread Starter
Hyperactive Member
-
May 25th, 2009, 04:50 AM
#2
Re: internet transfer control INET PASSIVE TRANSFER
i don't believe you can do this with inet, but you can using ftp APIs
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
May 25th, 2009, 07:44 AM
#3
Thread Starter
Hyperactive Member
-
May 25th, 2009, 03:49 PM
#4
Re: internet transfer control INET PASSIVE TRANSFER
attach module from http://www.vbforums.com/showpost.php...09&postcount=8 to your project, then use code as below, the INTERNET_FLAG_PASSIVE is the constant to use passive connection
vb Code:
Dim session As Long, server As Long, ftpserver As String, user As String, pass As String Dim ret As Long, localfile As String, remotefile As String ftpserver = ' your ftp server user = 'login name pass = 'password localfile = App.Path & "\" & fname remotefile = fname session = InternetOpen(App.EXEName, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, INTERNET_FLAG_NO_CACHE_WRITE) server = InternetConnect(session, ftpserver, INTERNET_INVALID_PORT_NUMBER, user, pass, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0) ret = FtpPutFile(server, localfile, remotefile, FTP_TRANSFER_TYPE_BINARY, 0) if ret = 0 then msgbox "upload failed" InternetCloseHandle server InternetCloseHandle session
see the complete thread above for some troubleshooting and other information, there is also api to change directory on the remote server
Last edited by westconn1; May 25th, 2009 at 04:06 PM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
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
|