Results 1 to 3 of 3

Thread: Downloading

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    At my computer
    Posts
    187

    Exclamation

    I need to download a file from an anonymous FTP server to my computer. This seems like it should be quite simple, but I can't figure it out. Should I be using the Inet control? The file I need to download is this:

    ftp://weather.noaa.gov/data/forecast...tions/KFCA.TXT

    I want to save this file to C:\Anything through VB.
    - Visual Basic 6.0
    - Windows XP Home

  2. #2
    Guest
    Yes, it's the Inet control. Here's some code from one of my apps. (frmFTPOpts is where the user configures his/her ftp preferences

    Initialize Inet Control Like this (and set the protocol to "FTP"):
    Code:
      With InetSend
        .url = "ftp://" & frmFTPOpts.txtFTPaddress.Text
        .UserName = frmFTPOpts.txtFTPuser.Text
        .Password = frmFTPOpts.txtFTPpass.Text
        .RemotePort = frmFTPOpts.txtFTPPort.Text
      End With
    Execute FTP like this (you should change "PUT" to "GET")
    Code:
    Private Sub executeFTP()
      
      Me.lblSending.Caption = "Sending Orders..."
          
    On Error Resume Next             'Set up error handling for missed connections, etc.
    InetSend.Execute InetSend.url, _
                        "PUT " & App.path & "\orders\pending\" & fileName       
    If Err Then                      ' Handle error from the inet.execute function
            result = MsgBox("Error sending orders.  " & Err.Description, _
                            vbCritical + vbOKOnly + vbApplicationModal)
    err.clear
    End If
                      
    End Sub

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    At my computer
    Posts
    187

    Thumbs up

    Thanks a bunch!
    - Visual Basic 6.0
    - Windows XP Home

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