Foxtable(狐表)用户栏目专家坐堂 → [求助] WriteFile 错误


  共有2573人关注过本帖平板打印复制链接

主题:[求助] WriteFile 错误

帅哥哟,离线,有人找我吗?
laipiwen
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:375 积分:2800 威望:0 精华:0 注册:2015/4/29 11:50:00
[求助] WriteFile 错误  发帖心情 Post By:2019/1/21 15:49:00 [只看该作者]


图片点击可在新窗口打开查看此主题相关图片如下:screenshot_2019-01-21-15-36-57-960_com.tencent.wework.png
图片点击可在新窗口打开查看


请问老师 使用以下代码  在打开文件的时候  电脑上可以正常下载。手机端就出现截图所示的乱码,也有下载但是htm格式(如果是图片格式文件就正常),请问该如何修改代码?

Dim e As RequestEventArgs = args(0)
Dim file As String = ProjectPath &"RemoteFiles\" & e.Values("file")
e.WriteFile(file)

尝试这下面的代码  
http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=106494&skin=0

        Dim file As String = e.Values("file")
        Dim fs As System.IO.FileStream = Nothing
        fs = System.IO.File.Open("d:\" & 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=" & file
        '输出文件格式
        e.Response.C
        
        Dim output = e.response.OutputStream
        output.Write(btFile,0,btFile.Length)
        output.Close()

也是和  shenyl0211 一样报错。用不了
[此贴子已经被作者于2019/1/21 15:58:59编辑过]

 回到顶部