以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  下面这段代码如果我想每次上传到以日期为目录的下面该怎么办?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=52326)

--  作者:jinzhengbe
--  发布时间:2014/6/13 12:45:00
--  下面这段代码如果我想每次上传到以日期为目录的下面该怎么办?

Dim ftp1 As New FtpClient
ftp1.Host="tangrenjie.net"
ftp1.Account = "ftp"
ftp1.Password = "Zhengbe7761"

For Each File As String In FileSys.GetFiles("c:\\图片\\")
   ftp1.upload(file, "/" & Filesys.getname(file),True)
Next
If     Messagebox.show("上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
    Messagebox.show("上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If

 

 

现在是上传到固定的位置 例如 www.pic/pic。目录下

如果我要上传到www.pic/pic/当前日期 目录下应该怎么改代码?参考过下面的代码,但是不是很明白,请各位大师指点啊

 

 

Dim ex As New Exporter
ex
.SourceTableName = "订单"
ex.FilePath =
"c:\\temp\\gd.mdb"
ex.Filter =
"日期 = #" & Date.Today & "#"
If
FileSys.FileExists(ex.FilePath) Then \'如果目标文件已经存在
    FileSys.DeleteFile(ex.FilePath)
\'则删除之
End If

ex
.Export()
\'上传到FTP服务器

Dim
ftp1 As new ftpclient
ftp1.host=
"ftp.baidu.com"
ftp1.Account =
"foxtable"
ftp1.password =
"168168"
ftp1.upload(ex.FilePath,"/gd.mdb",True) \'上传


--  作者:有点甜
--  发布时间:2014/6/13 14:03:00
--  

 代码,如下

 

Dim ftp1 As New FtpClient
ftp1.Host="tangrenjie.net"
ftp1.Account = "ftp"
ftp1.Password = "Zhengbe7761"

Dim path As String = "/www.pic/pic/" & Date.Today
If ftp1.DirExists(path) = False Then
    ftp1.MakeDir(path)
End If
ftp1.OpenManager
For Each File As String In FileSys.GetFiles("c:\\图片\\")
    ftp1.upload(file, path & "/" & Filesys.getname(file),True)
Next

[此贴子已经被作者于2014-6-13 14:03:12编辑过]

--  作者:jinzhengbe
--  发布时间:2014/6/13 16:27:00
--  显示的是这个页面。有没有办法不显示这个页面直接上传呢?

图片点击可在新窗口打开查看此主题相关图片如下:123123.png
图片点击可在新窗口打开查看
显示的是这个页面。是要手工添加目录么?有没有办法不显示这个页面直接生成目录并且上传呢?
[此贴子已经被作者于2014-6-13 16:28:16编辑过]

--  作者:有点甜
--  发布时间:2014/6/13 16:28:00
--  

哦,忘记删除一句代码了

 

Dim ftp1 As New FtpClient
ftp1.Host="tangrenjie.net"
ftp1.Account = "ftp"
ftp1.Password = "Zhengbe7761"

Dim path As String = "/www.pic/pic/" & Date.Today
If ftp1.DirExists(path) = False Then
    ftp1.MakeDir(path)
End If

For Each File As String In FileSys.GetFiles("c:\\图片\\")
    ftp1.upload(file, path & "/" & Filesys.getname(file),True)
Next


--  作者:jinzhengbe
--  发布时间:2014/6/16 22:16:00
--  还是不行
还是不行图片点击可在新窗口打开查看
--  作者:有点甜
--  发布时间:2014/6/16 22:30:00
--  

 呃,你说的不是,是什么意思?提示错误还是怎样的?

 

 代码是应该没有错的,你的ftp必须先建有这个路径 /www.pic/pic/