7,763
社区成员
发帖
与我相关
我的任务
分享
aa = Year(Now)
bb = Month(Now)
cc = Day(Now)
dd = Hour(Now)
ee = Second(Now)
If Len(bb) = 2 Then
bb = Month(Now)
Else
bb = "0" & Month(Now)
End If
If Len(cc) = 2 Then
cc = Day(Now)
Else
cc = "0" & Day(Now)
End If
If Len(dd) = 2 Then
dd = Hour(Now)
Else
dd = "0" & Hour(Now)
End If
If Len(ee) = 2 Then
ee = Second(Now)
Else
ee = "0" & Second(Now)
End If
FileName = "aa" & aa & bb & cc & dd & ee
'MsgBox FileName
Inet1.Protocol = icFTP
Inet1.URL = "ftp://127.0.0.1"
Inet1.RemotePort = 21
Inet1.UserName = "aa"
Inet1.Password = "bb"
Label3.Caption = "正在上传....."
Inet1.Execute , "put" & " d:\aa.txt" & " " & "/" & FileName & ".txt"
ProgressBar1.Max = 100
ProgressBar1.Value = 0
Do While Inet1.StillExecuting
DoEvents
If ProgressBar1.Value < ProgressBar1.Max Then ProgressBar1.Value = ProgressBar1.Value + 1
If ProgressBar1.Value = ProgressBar1.Max Then ProgressBar1.Value = 0
'Label4.Caption = Val(Label4.Caption) + 1
'Label4.Refresh
Loop
ProgressBar1.Value = ProgressBar1.Max
Inet1.Execute , "close"
Inet1.Execute , "quit"
Label3.Caption = "上传成功"
Private Sub Inet1_StateChanged(ByVal State As Integer)
Select Case State
Case 1
Text1.Text = "正在查询所指定的主机的IP地址"
Case 2
Text1.Text = "成功地找到所指定的主机的IP地址"
Case 3
Text1.Text = "正在与主机连接"
Case 4
Text1.Text = "已与主机连接成功"
Case 5
Text1.Text = "正在向主机发送请求"
Case 6
Text1.Text = "发送请求已成功"
Case 7
Text1.Text = "在接收主机的响应"
'有的时候出错在这里
Case 8
Text1.Text = "成功地接收到主机的响应"
Case 9
Text1.Text = "正在解除与主机的连接"
Case 10
Text1.Text = "已成功地与主机解除了连接"
Case 11
Text1.Text = "与主机通讯时出现了错误"
'有的时候也在这里。。。
Case 12
Text1.Text = "请求已经完成,并且所有数据均已接收到"
End Select
End Sub