蓝版:用你的代码,图片文件越小,显示越多,与浏览器无关(手机、电脑都测了)。
附相关全部代码:
Dim fl As String = "e:\web\" & e.path '"e:\web"为网页根目录.e.path的路径含网页文件名,分割符是"\",不是"/"
If filesys.FileExists(fl) '如果是请求一个已经存在的文件
Dim idx As Integer = fl.LastIndexOf(".") '文件名中最后一个小数点位置
Dim ext As String = fl.SubString(idx) '获取文件扩展名
Select Case ext
Case ".jpg",".png",".bmp",".wmf",".js",".css",".html",".htm",".doc",".docx",".xls",",xlsx"
e.WriteFile(fl) '则发送此文件
Return '这里必须返回
End Select
End If
'用户内外网判断:Host: 返回IP地址,据此可以判断用户是外网还是内网用户
'If e.host="10.22.1.40" Then '内网
'ElseIf e.host="123.81.249.43" Then '外网
'End If
'登录:当用户第一次访问时,自动跳转到登录页面登录.htm,要求输入用户名和密码.如果身份验证失败,重新进入登录页面,并提示错误
'当验证通过后,自动跳转到首页.htm,并可访问任何其他页面.退出登录时,清除当前的登录状态,重新进入登录页面.
'身份验证
Dim wb As New weui
Dim Verified As Boolean '用于标记用户是否通过了身份验证
Dim UserName As String = e.Cookies("username") '从本机临时存储的cookie中获取用户名.Cookies是字典,包括所有的Cookie
Dim Password As String = e.Cookies("password") '从cookie中获取用户密码
Dim s1,s2,rw,rw0,fqr,jsr,jsr0,nms(),nm,bmmc As String
Dim fqrq As Date
Dim i,count As Integer
Dim dt As DataTable
Dim dc As DataCol
Dim dr,dr1 As DataRow
Select Case e.path
Case "test.htm"
wb.AddForm("","form1","test.htm")
dr = DataTables("合同评审").SQLFind("[_Identify]=296")
With wb.AddInputGroup("form1","ipg1","附件")
With .AddTextArea("附件",5)
.Value = dr("附件")
End With
End With
Dim file As String = dr("附件") '含回车的多行文件名
Dim Lst() As String = file.Split(vbcrlf) '文件名数组
If Lst.Length >0 Then '如果有附件
With wb.AddListGroup("form1", "lsg", "查看附件")
If Lst.Length=1 Then '只有一个附件
.Add("查看附件","查看附件", "", "download.htm?file=" & UrlEncode(lst(0))) '(含路径)附件的url编码
Else
For i = 0 To Lst.Length-1
Dim zj As Integer = lst(i).IndexOf("/")
lst(i)=lst(i).SubString(zj)
.Add("查看附件" & i+1,"查看附件" & i+1, "", "download.htm?file=" & UrlEncode(lst(i)))
Next
End If
End With
End If
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "审批", "submit")
End With
Case "download.htm" '查看附件
Dim file As String = "e:\项目管理系统" & e.Values("file").replace("/","\")
e.WriteFile(file)
'Dim file As String = e.Values("file")
'Dim fs As System.IO.FileStream = Nothing
'fs = System.IO.File.Open("e:\项目管理系统" & 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=" & UrlEncode(FileSys.GetName(file))
'e.Response.C
'Dim output = e.response.OutputStream
'output.Write(btFile,0,btFile.Length)
'output.Close()
End Select
e.WriteString(wb.Build)
甜版:用你的代码,下载doc文件出现10楼的错误,下载图片文件出现以下错误:
此主题相关图片如下:2345截图20170913122234.png
![dvubb 图片点击可在新窗口打开查看](UploadFile/2017-9/201791312414239333.png)