Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to PUT or SEND a file to a FTP server?? 1

Status
Not open for further replies.

LordDuzy

Programmer
Feb 12, 2004
22
PL
When i do like

Inet1.Execute "SEND c:\file1.txt /file1.txt", icByteArray

there's an error: cannot coerce type (35760)

what do I have to do??
icString fails also

help me plz!
 
Please provide all of your code that pertains to the INET control.



[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!

Ever feel like you're banging your head against a tree? I did, so I cut down the tree.
 


With Inet1
.Protocol = icFTP
.URL = "ftp://xxxxxxxxxxxxx"
.AccessType = icDirect
.Password = "*********"
.UserName = "*********"
End With

Inet1.Execute , "SEND C:\windows\pulpit\keys.txt /keys.txt"

 
' Try something like this...

Dim IPAddress as String
IPAddress = "192.168.1.1" ' Use your IP address here

Inet1.AccessType = icFTP
Inet1.URL = "ftp://" & IPAddress
Inet1.Password = "whatever" ' Password for the ftp Server
Inet1.UserName = "whatever" ' Username for the ftp Server
Inet1.Execute , "PUT C:\windows\pulpit\keys.txt /keys.txt"
Do While Inet1.StillExecuting = True
DoEvents
Loop


But while you're at it, take advantage of the StateChanged event... This one uses a text box named txtFTPmessages...

Private Sub Inet1_StateChanged(ByVal State As Integer)
Select Case State
Case icNone
txtFTPmessages.Text = Time & " Nothing Happening..." & vbCrLf & txtFTPmessages.Text
Case icResolvingHost
txtFTPmessages.Text = Time & " Resolving Host..." & vbCrLf & txtFTPmessages.Text
Case icHostResolved
txtFTPmessages.Text = Time & " Host Resolved" & vbCrLf & txtFTPmessages.Text
Case icConnecting
txtFTPmessages.Text = Time & " Connecting..." & vbCrLf & txtFTPmessages.Text
Case icConnected
txtFTPmessages.Text = Time & " Connected" & vbCrLf & txtFTPmessages.Text
Case icRequesting
txtFTPmessages.Text = Time & " Requesting..." & vbCrLf & txtFTPmessages.Text
Case icRequestSent
txtFTPmessages.Text = Time & " Request Sent" & vbCrLf & txtFTPmessages.Text
Case icReceivingResponse
txtFTPmessages.Text = Time & " Receiving Response..." & vbCrLf & txtFTPmessages.Text
Case icResponseReceived
txtFTPmessages.Text = Time & " Response Received" & vbCrLf & txtFTPmessages.Text
Case icDisconnecting
txtFTPmessages.Text = Time & " Disconnecting..." & vbCrLf & txtFTPmessages.Text
Case icDisconnected
txtFTPmessages.Text = Time & " Disconnected" & vbCrLf & txtFTPmessages.Text
Case icError
txtFTPmessages.Text = Time & " Error!" & vbCrLf & Inet1.ResponseInfo & vbCrLf & txtFTPmessages.Text
Case icResponseCompleted
txtFTPmessages.Text = Time & " Response Completed" & vbCrLf & txtFTPmessages.Text
End Select
End Sub

I hope this helps... :)

[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!

Ever feel like you're banging your head against a tree? I did, so I cut down the tree.
 
cool
It works. Thanks for the help :)
Here's a star for you
 
My pleasure, and nice to meet you!

[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!

Ever feel like you're banging your head against a tree? I did, so I cut down the tree.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top