Foxtable(狐表)用户栏目专家坐堂 → [求助]移动开发 审批前怎么打开上传的附件?


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

主题:[求助]移动开发 审批前怎么打开上传的附件?

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110811 积分:563993 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/9/12 21:27:00 [显示全部帖子]

应该是file2=A.docx

以下代码测试通过

Select Case e.Path
    Case "test.htm"
        Dim wb As New weui
        wb.AddForm("","form1","download.htm?file=" & UrlEncode("F2/123.doc"))
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "审批", "submit")
        End With
        e.WriteString(wb.Build)
    Case "download.htm"
        Dim file As String = e.Values("file")
        Dim fs As System.IO.FileStream = Nothing
        fs = System.IO.File.Open("f:\" & file, System.IO.FileMode.Open)
        Dim btFile As Byte() = New Byte(fs.Length - 1) {}
        fs.Read(btFile, 0, Convert.ToInt32(fs.Length))
        fs.Close()
        
        e.Response.Headers("Content-Disposition") = "attachment;filename=" & FileSys.GetName(file)
        '输出文件格式
        e.Response.C
        
        Dim output = e.response.OutputStream
        output.Write(btFile,0,btFile.Length)
        output.Close()
End Select

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110811 积分:563993 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/9/12 21:27:00 [显示全部帖子]

这样也可以

Select Case e.Path
    Case "test.htm"
        Dim wb As New weui
        wb.AddForm("","form1","test.htm")
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "审批", "button","download.htm?file=" & UrlEncode("F2/Northwind.mdb"))
        End With
        e.WriteString(wb.Build)
    Case "download.htm"
        Dim file As String = "f:\" & e.Values("file").replace("/","\")
        e.WriteFile(file)
End Select

 回到顶部