以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  ftp动态设置文件存储位置,帮助例子实现不了  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=141832)

--  作者:pzhwjx
--  发布时间:2019/10/12 0:44:00
--  ftp动态设置文件存储位置,帮助例子实现不了
如题,测试帮助文档里的例子只能实现本地电脑,远程没法实现。

Select Case e.DataCol.Name
    Case "图片" \'如果在图片列插入文件
        e.Subfolder = e.DataRow("部门"\'将此文件存放在目录名为部门名称的子目录中.

End
Select


局域网络版Serv-U架构滴ftp服务器如何实现动态设置文件存储位置。请教如何代码实现。


--  作者:有点蓝
--  发布时间:2019/10/12 8:47:00
--  
这种要自己写代码上传文件:http://www.foxtable.com/webhelp/topics/1410.htm
--  作者:shenyl0211
--  发布时间:2019/10/13 13:41:00
--  

BeforeAddFile:

例子:

If e.DataCol.name = "附件" Then

    Select Case e.DataTable.Name

        Case "审查管理"

            If _username = e.DataRow("项目经理") OrElse _username = e.DataRow("编写设计") Then

                e.Cancel = False

                Dim filepath As String = "/审查管理/" & e.DataRow("编写设计")

                If ftp1.DirExists(filepath) = False Then

                    ftp1.MakeDir(filepath)

                End If

                e.path = filepath

                ftp1.RootDir = filepath

            Else

                e.cancel = True

            End If

        Case "文件管理"

            If _username = e.DataRow("发布人") OrElse (_usergroup.Contains(e.DataRow("发布部门")) AndAlso (_userroles = "部门领导" OrElse _userroles = "财务领导" OrElse _userroles = "生产领导")) Then

                e.Cancel = False

                If e.DataRow.IsNull("文号年份") Then

                    MessageBox.Show("《文号年份》不能空")

                    e.Cancel=True

                    Return

                End If

                Dim filepath As String = "/文件管理/" & e.DataRow("文号年份")  & "/" & e.DataRow("发布人")

                If ftp1.DirExists("/文件管理/" & e.DataRow("文号年份")) = False Then

                    ftp1.MakeDir("/文件管理/" & e.DataRow("文号年份"))

                End If

                If ftp1.DirExists(filepath) = False Then

                    ftp1.MakeDir(filepath)

                End If

                e.path = filepath

                ftp1.RootDir = filepath

            Else

                e.cancel = True

            End If

        Case "固资申请","合同评审"

            If (_username = e.DataRow("申请人") AndAlso e.DataRow.IsNull("审批日期")) OrElse _userroles = "开发者" Then

                e.Cancel = False

                Dim ab1 As Date = e.DataRow("申请日期") ’含时间

                Dim ab2 As String = CStr(ab1)

                ab2=ab2.SubString(0,4) & ab2.SubString(5,2) & ab2.SubString(8,2) & ab2.SubString(11,2) & ab2.SubString(14,2)

                Dim str As String = e.DataTable.Name

                Dim filepath As String = "/" & str & "/" & e.DataRow("申请人") & "/" & ab2

                If ftp1.DirExists("/" & str & "/" & e.DataRow("申请人")) = False Then

                    ftp1.MakeDir("/" & str & "/" & e.DataRow("申请人"))

                End If

                If ftp1.DirExists(filepath) = False Then

                    ftp1.MakeDir(filepath)

                End If

                e.path = filepath

                ftp1.RootDir = filepath

            Else

                e.cancel = True

            End If

    End Select

End If