以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  登录引用  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=98996)

--  作者:zhangjian222200
--  发布时间:2017/4/10 20:13:00
--  登录引用
折腾半天,各种移动文档、以前的图片引用,不管怎么弄图片都不显示

这是首页引用图大代码,怎么弄,都不显示(图片在e:/langwo/201704/)

        For Each dr As DataRow In drs
            \'msgbox(13-1)
            Dim zhansz As String = dr("展示照") \'定义,年龄
            Dim bianh As String = dr("会员编号") \'定义,年龄
            Dim nianl As String = dr("年龄") \'定义,年龄
            Dim xuel As String = dr("学历") \'定义,学历
            Dim huny As String = dr("婚姻状况") \'定义,婚姻状况
            Dim suozqx As String = dr("所在区县") \'定义,所在区县
            Dim suozshi As String = dr("所在市") \'定义,所在市
            Dim suozs As String = dr("所在省") \'定义,所在省
            \'msgbox(14)
            With wb.AddArticle("","ar" & bianh)
                .AddImage("../langwo/" & zhansz)   \'现在这样就不显示
                \'.AddImage("./images/zhanshi/" & zhansz)   \'之前这样就显示的
                msgbox("编号:" & bianh & "照片:" & zhansz)
                .Attribute = "style=\'padding:0.5em;\'"
            End With
            wb.AddForm("","form" & bianh,"test.htm")
            \'msgbox(15)
            With wb.AddInputGroup("form" & bianh,"ipg" & bianh)
                With .AddInput("xm" & bianh,"年龄","text")
                    .Value = nianl & "岁|" & xuel & "|" & huny
                    .Readonly= True
                End With
                With .AddInput("pw" & bianh,"城市","text")   \' "\'">"\'" ,表达式留存
                    .Value = suozqx & ">" & suozshi & ">" & suozs
                    .Readonly= True
                End With
            End With

            With wb.AddButtonGroup("form" & bianh,"btg" & bianh,False)
                .Add("btn1" & bianh, "查看TA的资料", "submit")
            End With
        Next

这是保存文件代码:
            For Each key As String In e.Files.Keys
                If key = "up1" Then
                    For Each fln As String In e.Files(key)
                        \'msgbox(0)
                        Dim ext As String = fln.Split(".")(1)
                        NewName = Format(Date.Now, "yyyyMMddHHmmss") & Rand.Next(10000,99999) & "." & ext
                        \'NewName = Format(Date.Now, "yyyyMMddHHmmssffffff") & Rand.Next(10000) & "." & ext
                        e.SaveFile(key, fln, ProjectPath & Format(Date.Today, "yyyyMM") & "\\" & NewName)
                        \'e.SaveFile(key, fln, ProjectPath & Format(Date.Today, "yyyyMMdd") & "\\" & NewName)
                        \'e.SaveFile(key, fln, ProjectPath & "Attachments\\" & NewName)
                        dr("展示照") &= iif(dr.IsNull("展示照"), "", vbcrlf) & Format(Date.Today, "yyyyMM") & "\\" & NewName
                        \'dr("展示照") &= iif(dr.IsNull("展示照"), "", vbcrlf) & NewName
                    Next
                End If
            Next
            For Each key1 As String In e.Files.Keys
                If key1 = "up4" Then
                    For Each fln1 As String In e.Files(key1)
                        \'msgbox(1)
                        Dim ext1 As String = fln1.Split(".")(1)
                        NewName = Format(Date.Now, "yyyyMMddHHmmss") & Rand.Next(10000,99999) & "." & ext1
                        \'NewName = Format(Date.Now, "yyyyMMddHHmmssffffff") & Rand.Next(10000) & "." & ext1
                        e.SaveFile(key1, fln1, ProjectPath & Format(Date.Today, "yyyyMM") & "\\" & NewName)
                        \'e.SaveFile(key1, fln1, ProjectPath & Format(Date.Today, "yyyyMMdd") & "\\" & NewName)
                        \'e.SaveFile(key1, fln1, ProjectPath & "Attachments\\" & NewName)
                        dr("生活照") &= iif(dr.IsNull("生活照"), "", vbcrlf) & Format(Date.Today, "yyyyMM") & "\\" & NewName
                        \'dr("生活照") &= iif(dr.IsNull("生活照"), "", vbcrlf) & NewName

                    Next
                End If
            Next
这是table页面显示的文件名称:(尝试将下图的\\,改成“/”,也显示不成功)

图片点击可在新窗口打开查看此主题相关图片如下:qq图片201704102007255565.png
图片点击可在新窗口打开查看

[此贴子已经被作者于2018/2/8 17:59:03编辑过]

--  作者:有点蓝
--  发布时间:2017/4/10 20:51:00
--  
图片路径依赖事件头的路径

e:/Web/langwo/201704/

--  作者:zhangjian222200
--  发布时间:2017/4/10 21:20:00
--  
我也查看了前几天的回复,原来原因在于,通用事件头:
Dim fl As String = "e:\\web\\" & e.path  ‘1.这里改为: ProjectPath & e.path,那么各个生成的网页是不是等于放在项目文件夹下?
                                                            ’2.如果将来用使用远程图片,是不是改为ProjectPath & e.path,更好
If filesys.FileExists(fl)
    Dim idx As Integer = fl.LastIndexOf(".")
    Dim ext As String  = fl.SubString(idx)
    Select Case ext
        Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar"
            e.WriteFile(fl)
            Return \'这里必须返回
    End Select
End If

3.如果不改通用事件头,下面粉色改为:e.SaveFile(key, fln, "e:\\web\\" & Format(Date.Today, "yyyyMM") & "\\" & NewName),应该也可以吧?
                If key = "up1" Then
                    For Each fln As String In e.Files(key)
                        Dim ext As String = fln.Split(".")(1)
                        NewName = Format(Date.Now, "yyyyMMddHHmmss") & Rand.Next(10000,99999) & "." & ext
                        e.SaveFile(key, fln, ProjectPath & Format(Date.Today, "yyyyMM") & "\\" & NewName)
                        dr("展示照") &= iif(dr.IsNull("展示照"), "", vbcrlf) & Format(Date.Today, "yyyyMM") & "\\" & NewName
                    Next
[此贴子已经被作者于2017/4/10 21:21:46编辑过]

--  作者:有点蓝
--  发布时间:2017/4/10 21:27:00
--  
1、是

2、文件放在哪里都不是问题,自己喜欢就好

3、可以