|
-
Apr 22nd, 2002, 09:26 PM
#1
Thread Starter
Member
uploading to server
Any easy code samples for uploading web pages to a server using VB out there?
-
Apr 22nd, 2002, 09:29 PM
#2
Hyperactive Member
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.
-
Apr 22nd, 2002, 09:38 PM
#3
Thread Starter
Member
I'm not very familiar with ftp code at all. Would you have a code sample?
-
Apr 22nd, 2002, 09:59 PM
#4
Hyperactive Member
create a command then execute it.
VB Code:
command = "put c:\data\myImage.jpg /users/me/myImage.jpg"
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:
Select Case State
Case icResolvingHost
'txtStatus.Text = txtStatus.Text & "Resolving Host" & vbCrLf
Case icHostResolved
'txtStatus.Text = txtStatus.Text & "Host Resolved" & vbCrLf
Case icConnecting
'txtStatus.Text = txtStatus.Text & "Connecting to Host" & vbCrLf
Case icConnected
'txtStatus.Text = txtStatus.Text & "Connected to Host" & vbCrLf
Case icRequesting
'txtStatus.Text = txtStatus.Text & "Sending Request" & vbCrLf
Case icRequestSent
'txtStatus.Text = txtStatus.Text & "Request Sent" & vbCrLf
Case icReceivingResponse
'txtStatus.Text = txtStatus.Text & "Receiving Response" & vbCrLf
Case icResponseReceived
'txtStatus.Text = txtStatus.Text & "Response Received" & vbCrLf
Case icDisconnecting
'txtStatus.Text = txtStatus.Text & "Disconnecting from Host" & vbCrLf
Case icDisconnected
'txtStatus.Text = txtStatus.Text & "Disconnected from Host" & vbCrLf
Case icError
txtStatus.Text = txtStatus.Text & vbCrLf & "An error occurred during the upload process" & vbCrLf
If Err.Number = 0 Then
MsgBox ("Directory already Exists")
Else
MsgBox (Err.Number & " " & Err.Description)
End If
exitEnabled = True
Case icResponseCompleted
'YOUR CODE TO EXECUTE WHEN FINISHED GOES HERE
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.
-
Apr 22nd, 2002, 10:00 PM
#5
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|