Foxtable(狐表)用户栏目专家坐堂 → 如何把互联网的文件管理器设置成与本地的一样?


  共有16140人关注过本帖树形打印复制链接

主题:如何把互联网的文件管理器设置成与本地的一样?

帅哥哟,离线,有人找我吗?
狐狸爸爸
  11楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251054 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2010/12/2 16:41:00 [显示全部帖子]

我在命令窗口测试下面的代码,通过测试,前提是文号和类型,不能是中文:

 

Dim ftp1 As new ftpclient
ftp1.host="219.138.92.236"
ftp1.Account = "hmsx"
ftp1.password = "hmsx"
Dim ph As String = "/2010/"
If ftp1.DirectoryExists(ph) = False
    ftp1.MakeDir(ph)
End If
ph = ph & Tables("表A").Current("类型") & "/"
If ftp1.DirectoryExists(ph) = False
    ftp1.MakeDir(ph)
End If
ph = ph & Tables("表A").Current("文号") & "/"
If ftp1.DirectoryExists(ph) = False
    ftp1.MakeDir(ph)
End If


 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  12楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251054 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2010/12/2 17:32:00 [显示全部帖子]

我反复执行多次,偶尔会提示操作超时,然后提示505错误。

设置TimeOut属性,延长操作尝试时间之后,反复执行就不再出现错误了:

 

Dim ftp1 As new ftpclient
ftp1.host="219.138.92.236"
ftp1.Account = "hmsx"
ftp1.password = "hmsx"
ftp1.TimeOut = 10000
Dim ph As String = "/2010/"
If ftp1.DirectoryExists(ph) = False
    ftp1.MakeDir(ph)
End If
ph = ph & Tables("表A").Current("类型") & "/"
If ftp1.DirectoryExists(ph) = False
    ftp1.MakeDir(ph)
End If
ph = ph & Tables("表A").Current("文号") & "/"
If ftp1.DirectoryExists(ph) = False
    ftp1.MakeDir(ph)
End If

 

再次提示:我不是用中文测试的。

[此贴子已经被作者于2010-12-2 17:37:57编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  13楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251054 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2010/12/2 18:30:00 [显示全部帖子]

在命令窗口执行下面的代码,然后选择多个文件并测试看看:

 

Dim dlg As New OpenFileDialog
dlg.MultiSelect = True
If dlg.ShowDialog = DialogResult.OK Then
   For Each fl As String In dlg.FileNames
       Output.Show(fl)
   Next
End If

 

剩下的你可以自己完成了。


 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  14楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251054 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2010/12/2 22:21:00 [显示全部帖子]

测试通过:

 

Dim dlg As New OpenFileDialog
dlg.MultiSelect = True
Dim fl As String
Dim nl As String
Dim ftp1 As new ftpclient
ftp1.host="219.138.92.236"
ftp1.Account = "hmsx"
ftp1.password = "hmsx"
ftp1.TimeOut = 10000
Dim ph As String = "/2010/"
If ftp1.DirectoryExists(ph) = False
    ftp1.MakeDir(ph)
End If
ph = ph & Tables("表A").Current("类型") & "/"
If ftp1.DirectoryExists(ph) = False
    ftp1.MakeDir(ph)
End If
ph = ph & Tables("表A").Current("文号") & "/"
If ftp1.DirectoryExists(ph) = False
    ftp1.MakeDir(ph)
End If
If dlg.ShowDialog = DialogResult.OK Then
    If ftp1.DirectoryExists(ph) = False
        ftp1.MakeDir(ph)
    End If   
    For Each fl  In dlg.FileNames
        nl = ph & FileSys.GetName(fl)
        ftp1.upload(fl, nl,True)
        Dim v As String = Tables("表A").Current("报告")
        If v = "" Then
            v = nl
        Else
            v = v & vbcrlf & nl
        End IF
        Tables("表A").Current("报告") = V
    Next
Else
    Return
End If


 

你原来的错误在于:

 

 For Each fl  In dlg.FileNames

        fl = dlg.FilelName
        nl = ph & FileSys.GetName(fl)


红色部分就是你的错误根源,虽然你选择了多个文件,但是你这样的代码等于是重复使用其中一个文件而已。

[此贴子已经被作者于2010-12-2 22:27:33编辑过]

 回到顶部
总数 15 上一页 1 2