Results 1 to 5 of 5

Thread: uploading to server

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2001
    Posts
    57

    Exclamation uploading to server

    Any easy code samples for uploading web pages to a server using VB out there?

  2. #2
    Hyperactive Member Blinky Bill's Avatar
    Join Date
    Mar 2002
    Location
    Happily munching on the greenery in your garden
    Posts
    349
    use the Inet control, set its protocol to ftp, give a host name, user name and password and use ftp commands to put the files.

    use the inet_statechanged method to find out when its finished.

    hope this helps
    We don't know what's wrong. . . So the best bet might be to remove something surgically.

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2001
    Posts
    57
    I'm not very familiar with ftp code at all. Would you have a code sample?

  4. #4
    Hyperactive Member Blinky Bill's Avatar
    Join Date
    Mar 2002
    Location
    Happily munching on the greenery in your garden
    Posts
    349
    create a command then execute it.

    VB Code:
    1. command = "put c:\data\myImage.jpg /users/me/myImage.jpg"
    2. Call Inet1.Execute(, command)

    Then to check that it has finished - Inet ftp commands do not halt the flow of the program - i.e. the next line executes before you get a result.

    VB Code:
    1. Select Case State
    2.         Case icResolvingHost
    3.             'txtStatus.Text = txtStatus.Text & "Resolving Host" & vbCrLf
    4.         Case icHostResolved
    5.             'txtStatus.Text = txtStatus.Text & "Host Resolved" & vbCrLf
    6.         Case icConnecting
    7.             'txtStatus.Text = txtStatus.Text & "Connecting to Host" & vbCrLf
    8.         Case icConnected
    9.             'txtStatus.Text = txtStatus.Text & "Connected to Host" & vbCrLf
    10.         Case icRequesting
    11.             'txtStatus.Text = txtStatus.Text & "Sending Request" & vbCrLf
    12.         Case icRequestSent
    13.             'txtStatus.Text = txtStatus.Text & "Request Sent" & vbCrLf
    14.         Case icReceivingResponse
    15.             'txtStatus.Text = txtStatus.Text & "Receiving Response" & vbCrLf
    16.         Case icResponseReceived
    17.             'txtStatus.Text = txtStatus.Text & "Response Received" & vbCrLf
    18.         Case icDisconnecting
    19.             'txtStatus.Text = txtStatus.Text & "Disconnecting from Host" & vbCrLf
    20.         Case icDisconnected
    21.             'txtStatus.Text = txtStatus.Text & "Disconnected from Host" & vbCrLf
    22.         Case icError
    23.             txtStatus.Text = txtStatus.Text & vbCrLf & "An error occurred during the upload process" & vbCrLf
    24.             If Err.Number = 0 Then
    25.                 MsgBox ("Directory already Exists")
    26.             Else
    27.                 MsgBox (Err.Number & "  " & Err.Description)
    28.             End If
    29.             exitEnabled = True
    30.         Case icResponseCompleted
    31.             'YOUR CODE TO EXECUTE WHEN FINISHED GOES HERE
    32. end select

    If you want to find out all the ftp commands - open your command prompt, run ftp and type help ftp
    We don't know what's wrong. . . So the best bet might be to remove something surgically.

  5. #5
    Hyperactive Member Blinky Bill's Avatar
    Join Date
    Mar 2002
    Location
    Happily munching on the greenery in your garden
    Posts
    349
    Sorry, the select case code goes in

    Private Sub Inet1_StateChanged(ByVal State As Integer)

    Just double click on the inet control to get this method.
    We don't know what's wrong. . . So the best bet might be to remove something surgically.

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