标题:在线编辑器中WORD文件数据库保存的问题.
只看楼主
zkh
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2006-7-10
 问题点数:0 回复次数:2 
在线编辑器中WORD文件数据库保存的问题.

各位老师好!
原网站后台所用在线编辑器类似于本论坛的编辑器,支持.doc文件格式上传,能保存在网站服务器文件夹中,但是保存在数据库中的格式是这样(content字段中)<IMG SRC="upfile/200761110291616546.doc" border=0>前台不能链接显示,而eWebEditor这种编辑器保存格式:<IMG src="/wangyi/admin/eWebEditor/sysimage/file/doc.gif" border=0><A

href="/wangyi/admin/eWebEditor/UploadFile/200713172624389.doc" target=_blank>2005年廉政工作

总结.doc</A>,我的问题是如何修改本编辑器,让文件在数据库中保存<IMG SRC="upfile/200761110291616546.doc" border=0>变成:<IMG src="/wangyi/admin/eWebEditor/sysimage/file/doc.gif" border=0><A

href="/wangyi/admin/eWebEditor/UploadFile/200713172624389.doc" target=_blank>2005年廉政工作

总结.doc</A>这样.如何修改代码?在哪个文件中修改?谢谢!!

我使用的编辑器全部文件:

89qNJFEY.rar (34.34 KB) 在线编辑器中WORD文件数据库保存的问题.


[此贴子已经被作者于2007-6-13 11:39:20编辑过]

搜索更多相关主题的帖子: 数据库 编辑器 WORD 文件 保存 
2007-06-13 09:29
zkh
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2006-7-10
得分:0 

我添加以下文件中的红字部分后,代码能运行,数据保存到数据库后应该为:
<A

href="/wangyi/admin/eWebEditor/UploadFile/200713172624389.doc" target=_blank>2005年廉政工作

总结.doc</A>。
可是"<"和">"被替换成&gt之类,成了:&gt a href="...."&gt /a &gt,请问怎回事?还要改哪?应该怎么改?



<!--#include FILE="admin/upload.inc"-->
<html>
<head>
<title>文件上传</title>
</head>
<body class="tdbg">
<script>

</script>
<%
'上传方法,0=无组件
dim upload_type
upload_type=0

dim upNum
dim uploadsuc
dim Forumupload
dim ranNum
dim uploadfiletype
dim upload,file,formName,formPath,iCount,filename,fileExt,pic_type
'上传文件大小100K
dim uploadsize
uploadsize=500
upNum=session("upNum")
'屏蔽上传数量
'if upNum>3 then
if FALSE then
response.write "<font size=2>一次只能上传三个文件!</font>"
response.end
end if
response.write "<FONT color=red>"&upNum&"</font>"
select case upload_type
case 0
call upload_0()
case 1
call upload_1()
case else
response.write "本系统未开放插件功能"
response.end
end select
sub upload_0()
'建立上传对象
set upload=new upload_5xSoft
formPath=upload.form("filepath")
pic_type=cint(upload.form("pic_type"))
'在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"

response.write "<body class=tdbg leftmargin=5 topmargin=3>"

iCount=0
'列出所有上传了的文件
for each formName in upload.file
'生成一个文件对象
set file=upload.file(formName)
if file.filesize<100 then
response.write "<font size=2>请先选择你要上传的文件 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if

if file.filesize>cint(uploadsize)*1000 then
response.write "<font size=2>文件大小超过了限制100K [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
'判断文件的后缀名
fileExt=lcase(right(file.filename,4))
uploadsuc=false
Forumupload=split("gif,jpg,doc",",")
for i=0 to ubound(Forumupload)
if fileEXT="."&trim(Forumupload(i)) then
uploadsuc=true
exit for
else
uploadsuc=false
end if
next
if uploadsuc=false then
response.write "<font size=2>文件格式不正确 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
randomize
ranNum=int(90000*rnd)+10000
filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&fileExt
'如果 FileSize > 0 说明有文件数据
if file.FileSize>0 then
'保存文件
file.SaveAs Server.mappath(FileName)
for i=0 to ubound(Forumupload)
if fileEXT<>"."&trim(Forumupload(2)) then
response.write "<script>parent.myform.piccontent.value='"&FileName&"'</script>"
if pic_type=0 then
response.write "<script>parent.myform.txtcontent.value+=''</script>"
else
response.write "<script>parent.myform.txtcontent.value+='<img src="&FileName&" align=right>'</script>"
end if
else
response.write "<script>parent.myform.txtcontent.value+='<a href=/"&FileName&" target=_blank>"&fileext&"</a>'</script>"

end if
exit for
next
iCount=iCount+1
end if
set file=nothing
next
set upload=nothing
Htmend iCount&" 个文件上传结束!"
end sub
sub HtmEnd(Msg)
if upNum="" then upNum=1
session("upNum")=upNum+1
response.write "<font size=2>文件上传成功 [ <a href=# onclick=history.go(-1)>继续上传</a> ]</font>"
response.end
end sub
'--------将日期转化成文件名--------
function MakedownName(filename)
dim fname,Forumupload,u
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
fname = int(fname) + int((10-1+1)*Rnd + 1)
Forumupload=split(Forum_upload,",")
for u=0 to ubound(Forumupload)
if instr(filename,Forumupload(u))>0 then
uploadfiletype=Forumupload(u)
MakedownName=fname & "." & Forumupload(u)
exit for
end if
next
end function
%>
</body>
</html>


2007-06-13 14:54
zkh
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2006-7-10
得分:0 
问题已解决!

把上面红色代码中<a href=></a>改成[url]即可.

[此贴子已经被作者于2007-6-14 16:33:41编辑过]

2007-06-14 16:24



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-147030-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.884265 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved