Results 1 to 4 of 4

Thread: internet transfer control INET PASSIVE TRANSFER

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    272

    internet transfer control INET PASSIVE TRANSFER

    Hello people,

    I hope someone can help a newcomer with a problem.

    Im using the Inet control with the icFTP-protocol to transfer a single file to an FTP-server. Works perfect with the following code:


    Code:
    with Inet1
    .execute "FTP://[email protected] PUT "..........
    end with
    But my problem is i need to use passive transfers.. so i tried


    Code:
    with Inet1
    .execute "FTP://[email protected] quote PASV"
    .execute "FTP://[email protected] PUT "....................
    end with
    But it wont work.. how can i define this as a passive transfer?

    Im really thankfull for answers with sollutions or ideas.
    DONT RUN EXECUTABLE FILES FROM UNKNOWN SOURCES.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    272

    Re: internet transfer control INET PASSIVE TRANSFER

    can you please give me some easy APIs with PASV
    DONT RUN EXECUTABLE FILES FROM UNKNOWN SOURCES.

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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:
    1. Dim session As Long, server As Long, ftpserver As String, user As String, pass As String
    2.       Dim ret As Long, localfile As String, remotefile As String
    3.       ftpserver = ' your ftp server
    4.       user = 'login name
    5.       pass = 'password
    6.       localfile = App.Path & "\" & fname
    7.       remotefile = fname
    8.        
    9.       session = InternetOpen(App.EXEName, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, INTERNET_FLAG_NO_CACHE_WRITE)
    10.       server = InternetConnect(session, ftpserver, INTERNET_INVALID_PORT_NUMBER, user, pass, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0)
    11.       ret = FtpPutFile(server, localfile, remotefile, FTP_TRANSFER_TYPE_BINARY, 0)
    12.       if ret = 0 then msgbox "upload failed"
    13.       InternetCloseHandle server
    14.       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
  •  



Click Here to Expand Forum to Full Width