Results 1 to 10 of 10

Thread: VB6 - FTP Class for people doing FTP - FTP made easy

Threaded View

  1. #1

    Thread Starter
    Fanatic Member jian2587's Avatar
    Join Date
    Aug 2000
    Location
    I bet u need a fusion powered shuttle to reach my place...
    Posts
    963

    VB6 - FTP Class for people doing FTP - FTP made easy

    NOTE: Add reference to FTPC.dll first.
    VB Code:
    1. 'To use the object, declare it then create a new instance of it
    2. Dim WithEvents objFTPC As FTPClient
    3. Set objFTPC = New FTPClient
    4. 'To connect, supply it with required parameters
    5. objFTPC.Username = "Anonymous"
    6. objFTPC.Password = "Guest"
    7. objFTPC.PassiveMode = True
    8. objFTPC.RemoteHost = "ftp.ftphost.com"
    9. objFTPC.RemotePort = 21
    10. objFTPC.Connect
    11. 'To upload data,
    12. objFTPC.OpenDataConnection
    13. 'Wait for Data socket to be connected
    14. Do Until objFTPC.DataState = DS_CONNECTED
    15.     DoEvents
    16. Loop
    17. 'Upload data
    18. objFTPC.UploadFile "readme.txt"
    19. 'Then upload ur data whenever NeedData event is fired
    20. Private Sub objFTPC_NeedData()
    21. objFTPC.SendData "My data"
    22. End Sub
    23.  
    24. 'To download data,
    25. objFTPC.OpenDataConnection
    26. 'Wait for Data socket to be connected
    27. Do Until objFTPC.DataState = DS_CONNECTED
    28.     DoEvents
    29. Loop
    30. 'Download data
    31. objFTPC.DownloadFile "readme.txt"
    32. 'Then download ur data whenever IncomingData event is fired
    33. Private Sub objFTPC_IncomingData(BytesTotal As Long)
    34. Dim sData As String
    35. objFTPC.GetData sData
    36. End Sub
    37. 'That cover the basics. For more advance functions, post it here
    Attached Files Attached Files
    ASM,C,C++,BASIC,VB,JAVA,VBS,HTML,ASP,PHP,mySQL,VB.NET,MATLAB
    Programming is fun, but only if you're not on a tight deadline
    So I consider all those working engineers sad people

    VB FTP class
    3 page PHP crash course
    Crash Course on DX9 Managed with VB.NET covering basics till terrain creation

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