Control | upload | download | Download Control This is the source program for the control:
Project Name: my
Control Name: testftp
Dim FileName as String
Dim Connect as Boolean
Private Sub Cmdcd_click ()
Call Link
' Inet1.execute, CD c2000 '
Connect = True
End Sub
Private Sub Cmdlist_click ()
If connect = True Then
Inet1.execute, "LS"
Else
Label1.Caption = "Please click Connect first!"
End If
End Sub
Private Sub Combo1_click ()
FileName = Combo1.text ' file name of download file
End Sub
Private Sub Cmddown_click ()
Dim Filelast as String ' last name of file '
Dim savefilename as String ' file name in Ftpserver
Call Link
If FileName = "" Then
Label1.Caption = "Please select File to download!"
Else
Filelast = ""
For i = 1 to Len (FileName)
If Mid (FileName, I, 1) <> "." Then
Filelast = Filelast + Mid (FileName, I, 1)
Else
Filelast = ""
End If
Next
REDO:CommonDialog1.ShowSave
If InStr (1, Commondialog1.filename, "", 1) > 0 Then
Label1.Caption = "The file can ' t include space!"
MyVar = MsgBox ("Redo it?", "Download file")
If MyVar = "1" Then
GoTo REDO:
Else
GoTo Nodo:
End If
End If
Savefilename = Commondialog1.filename & "." & Filelast
Inet1.execute, "Get" & FileName & "" & Savefilename
End If
Nodo:
End Sub
Private Sub Cmdupload_click ()
Dim Savefilename as String
Dim upfilename as String ' file name of upload file include path
Dim MyVar
Savefilename = ""
Call Link
REDO:CommonDialog1.ShowOpen
If InStr (1, Commondialog1.filename, "", 1) > 0 Then
MsgBox "The file can ' t include space!"
MyVar = MsgBox ("Redo it?", "Upload file")
If MyVar = "1" Then
GoTo REDO:
Else
GoTo Nodo:
End If
End If
Upfilename = Commondialog1.filename
' MsgBox upfilename
For i = 1 to Len (upfilename)
If Mid (Upfilename, I, 1) <> "\" Then
Savefilename = Savefilename + Mid (upfilename, I, 1)
Else
Savefilename = ""
End If
Next
If savefilename = "" Then
Label1.Caption = "No file!"
Else
Inet1.execute, "put" & Upfilename & "" & Savefilename
End If
Nodo:
End Sub
Private Sub inet1_statechanged (ByVal State as Integer)
Select Case State
Case 1
Label1.Caption = "Querying the IP address of the specified host"
Case 2
Label1.Caption = "The IP address of the specified host was successfully found. "