额.....代码,自己改一下,这种只是上传,额外的自己改一下。
Select Case e.DataCol.Name
Case "附件"
Dim ftp1 As new ftpclient
ftp1.host="222.216.28.13"
ftp1.Account = "gongling"
ftp1.password = "1CCCEC22128b97"
ftp1.RootDir = "/gongling/web/"
Dim st As String = "Photo1/" & e.DataRow("年度") & "/" & e.DataRow("分类") & "/" & e.DataRow("标签")
If ftp1.DirExists(st) Then '判断目录是否存在
MessageBox.show("目录已经存在","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
MessageBox.show("目录不存在,是否创建!","提示",MessageBoxButtons.YesNo)
ftp1.MakeDir("photo1") '逐步创建目录,FT现在还不能一次连子目录创建
ftp1.MakeDir("photo1/" & e.DataRow("年度"))
ftp1.MakeDir("photo1/" & e.DataRow("年度") & "/" & e.DataRow("分类"))
ftp1.MakeDir("photo1/" & e.DataRow("年度") & "/" & e.DataRow("分类") & "/" & e.DataRow("标签"))
End If
Dim sm As String = st & "/" & FileSys.GetName(e.FileName)
Dim sn As String = ftp1.CurrentDir
If ftp1.FileExists(sm) Then '如果指定的文件存在
MessageBox.Show("文件已经存在!","提示")
ElseIf ftp1.Upload(e.SourceFolder & "\" & e.FileName,st & "/" & e.FileName) = True Then
Messagebox.show("上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
Messagebox.show("上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
End Select