Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. FTP Code

FTP Code

Scheduled Pinned Locked Moved Visual Basic
comsysadminxmlhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Michael101
    wrote on last edited by
    #1

    Hey Everyone, I've got a windows application and I want to know if anyone has or knows any code for FTPing files through the system. The code I've got so far is here, but I think I'm missing a class which I've failed to find. If anyone has different code that works, then that would be greatly appreciated! :-) This is what I have so far out of interest: Dim ftp As New Chilkat.Ftp2() <----- This is my error, Chilkat.FTP2() isn't defined!!! Dim success As Boolean ' Any string unlocks the component for the 1st 30-days. success = ftp.UnlockComponent("Anything for 30-day trial") If (success <> True) Then MsgBox(ftp.LastErrorText) Exit Sub End If ftp.Hostname = "ftp.chilkatsoft.com" 'What's the host name? ftp.Username = "****" 'What's the username? ftp.Password = "****" 'What's the password? 'The default data transfer mode is "Active" as opposed to "Passive". 'Connect and login to the FTP server. success = ftp.Connect() If (success <> True) Then MsgBox(ftp.LastErrorText) Exit Sub End If ' Change to the remote directory where the file will be uploaded. success = ftp.ChangeRemoteDir("junk") If (success <> True) Then MsgBox(ftp.LastErrorText) Exit Sub End If ' Upload a file. Dim localFilename As String localFilename = "hamlet.xml" 'Change that to the file I have to upload Dim remoteFilename As String remoteFilename = "hamlet.xml" 'Like wise. success = ftp.PutFile(localFilename, remoteFilename) If (success <> True) Then MsgBox(ftp.LastErrorText) Exit Sub End If ftp.Disconnect() MsgBox("File Uploaded!") Cheers, Michael :)

    D 1 Reply Last reply
    0
    • M Michael101

      Hey Everyone, I've got a windows application and I want to know if anyone has or knows any code for FTPing files through the system. The code I've got so far is here, but I think I'm missing a class which I've failed to find. If anyone has different code that works, then that would be greatly appreciated! :-) This is what I have so far out of interest: Dim ftp As New Chilkat.Ftp2() <----- This is my error, Chilkat.FTP2() isn't defined!!! Dim success As Boolean ' Any string unlocks the component for the 1st 30-days. success = ftp.UnlockComponent("Anything for 30-day trial") If (success <> True) Then MsgBox(ftp.LastErrorText) Exit Sub End If ftp.Hostname = "ftp.chilkatsoft.com" 'What's the host name? ftp.Username = "****" 'What's the username? ftp.Password = "****" 'What's the password? 'The default data transfer mode is "Active" as opposed to "Passive". 'Connect and login to the FTP server. success = ftp.Connect() If (success <> True) Then MsgBox(ftp.LastErrorText) Exit Sub End If ' Change to the remote directory where the file will be uploaded. success = ftp.ChangeRemoteDir("junk") If (success <> True) Then MsgBox(ftp.LastErrorText) Exit Sub End If ' Upload a file. Dim localFilename As String localFilename = "hamlet.xml" 'Change that to the file I have to upload Dim remoteFilename As String remoteFilename = "hamlet.xml" 'Like wise. success = ftp.PutFile(localFilename, remoteFilename) If (success <> True) Then MsgBox(ftp.LastErrorText) Exit Sub End If ftp.Disconnect() MsgBox("File Uploaded!") Cheers, Michael :)

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Well, first off, do you have the Chilkat FTP library[^]?? And have you added a reference to it in your project??

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups