Results 1 to 8 of 8

Thread: Setting FTP upload as "passive"

  1. #1

    Thread Starter
    Member Endorphine's Avatar
    Join Date
    Dec 2009
    Location
    Shelby, Ohio
    Posts
    51

    Setting FTP upload as "passive"

    How would I set my FTP uploads in my exe form active to passive?

    I emailed tech support to ask about how I can get around for my files to upload correctly and they said it needs to be passive.

    help?

    Edit:
    I found this .bas that says it'll allow FTP client in Passive but I'm not quit sure how to add it into my project.

    http://www.thevbzone.com/modWININET.bas
    Last edited by Endorphine; Dec 10th, 2009 at 10:10 PM.

  2. #2
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Setting FTP upload as "passive"

    Not sure this helps, FTP app I made long-long time ago for a friend uses passive, heres a snippet,

    'Connect to Server
    hConnection = InternetConnect(hOpen, TxtFTP_Server, INTERNET_INVALID_PORT_NUMBER, TxtUser, TxtPassword, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0)

  3. #3

    Thread Starter
    Member Endorphine's Avatar
    Join Date
    Dec 2009
    Location
    Shelby, Ohio
    Posts
    51

    Re: Setting FTP upload as "passive"

    It's useful... If I knew how to make it work within my project and with inet and how exactly to set it up properly.

    I'm still a bit new to VB.

    I just need to figure out how to get the upload function to work properly.

  4. #4

    Thread Starter
    Member Endorphine's Avatar
    Join Date
    Dec 2009
    Location
    Shelby, Ohio
    Posts
    51

    Re: Setting FTP upload as "passive"

    Well, I found this thread:
    http://www.vbforums.com/showthread.p...ht=passive+ftp

    I was messing around with the code, I referenced the .dll to my project and after that..
    I'm lost.

    All I need is the upload function but I do not know where to place everything.

    Excuse my VB newbie-ness.

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

    Re: Setting FTP upload as "passive"

    try searching the forum there have been many examples posted
    i remember posting an example using passive
    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

  6. #6

    Thread Starter
    Member Endorphine's Avatar
    Join Date
    Dec 2009
    Location
    Shelby, Ohio
    Posts
    51

    Re: Setting FTP upload as "passive"

    I've already done that.

    I'm just not understanding it I guess.

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

    Re: Setting FTP upload as "passive"

    if found this in previous post http://www.vbforums.com/showthread.p...tp+api+passive
    download module from http://www.vbforums.com/showpost.php...09&postcount=8 add module to your project
    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
    change the 5 variables to suit and try it
    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

  8. #8

    Thread Starter
    Member Endorphine's Avatar
    Join Date
    Dec 2009
    Location
    Shelby, Ohio
    Posts
    51

    Re: Setting FTP upload as "passive"

    Working, Thanks a lot.

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