ftp1.Host="60.165.164.48"
ftp1.Account = "8888"
ftp1.Password = "88888888"
ftp1.port ="21"
Dim dr As DataRow = 用户信息.Find("[Name] = '" & _UserName & "'")
If dr IsNot Nothing Then '如果找到了
Dim File1002 As String=ProjectPath & "Attachments\Images\" & _UserName & "100user.PNG"
Dim File2 As String=ProjectPath & "Attachments\Images\" & _UserName & "user.PNG"
Dim File10022 As String=ProjectPath & "Attachments\Images\" & _UserName & "$100user.PNG"
Dim File22 As String=ProjectPath & "Attachments\Images\" & _UserName & "$user.PNG"
Dim File As String="/" & FileSys.GetName( File2 ) '其中FileSys.GetName是获取不含路径文件名
msgbox(file)
Dim File100 As String="/" & FileSys.GetName( File1002 ) '其中FileSys.GetName是获取不含路径文件名
msgbox(file100)
If FileSys.FileExists( File22 ) Then '如果指定的文件存在
FileSys.MoveFile(File22,File2, True) '移动头像文件
msgbox("移动头像")
If ftp1.FileExists(file) Then
msgbox(ftp1.FileExists(file))
ftp1.DeleteFile(file)
msgbox(ftp1.DeleteFile(file))
ftp1.Upload(File2,File, False) '复制头像文件
Else
ftp1.Upload(File2,File, False) '复制头像文件
End If
End If
If FileSys.FileExists( File10022 ) Then '如果指定的文件存在
FileSys.MoveFile(File10022,File1002, True) '移动头像文件
If ftp1.FileExists(file100) Then
msgbox(ftp1.FileExists(file100) )
ftp1.DeleteFile(file100)
msgbox(ftp1.DeleteFile(file100))
ftp1.Upload(File1002,File100, False) '复制头像文件
Else
ftp1.Upload(File1002,File100,False) '复制头像文件
End If
End If
上述红色的地方显示上传失败,不知道怎么回事。ftp1本身上传没有问题。