ASP--从数据库中怎么把多张图片读出来(是用二进制存入数据库的)

supersual 2004-12-05 02:34:09
我是用二制存入数据库的,可我只能读出一张来,我想把它全部读到一张网页上,我不知道该怎么做?
...全文
237 17 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
supersual 2004-12-19
  • 打赏
  • 举报
回复
我前几天从书上找到的,不知道怎么样的,,请大家点评:

'存入用户目录
dim path,path1,objfile
set objfile=server.CreateObject("Scripting.FileSystemObject")
path="..\IMAGES\"& username & "\"
if not objfile.folderexists(Server.MapPath(""&path&"")) then
objfile.createfolder(server.mapPath(""&path&""))
end if
path1=objfile.getfilename(request.form("photo"))
path=path & path1
objfile.copyfile request.form("photo"),Server.MapPath(""&path&"")
sniper920 2004-12-08
  • 打赏
  • 举报
回复
学习
谢紫枫 2004-12-08
  • 打赏
  • 举报
回复
学习
supersual 2004-12-07
  • 打赏
  • 举报
回复
我也知道的,不过我是个初学者,能看懂的我就用,一时看不懂的,我先放下,,
多谢忠告!!!!!!!!!!!
yb2008 2004-12-06
  • 打赏
  • 举报
回复
最好不要存到数据库,存到文件夹:给你种方法:www.hc189.com/upload.rar
celerylhl 2004-12-06
  • 打赏
  • 举报
回复
用组件存到盘上,存库里不太好
Firec 2004-12-06
  • 打赏
  • 举报
回复
最好还是建立专用目录,数据库中只保存路径。
  • 打赏
  • 举报
回复
存到数据库不是一个明智的选择!
05358475856 2004-12-06
  • 打赏
  • 举报
回复
如果你的图片超过4M的话,这样就读不出来了
supersual 2004-12-06
  • 打赏
  • 举报
回复
谢谢!你们给我上了一节重要的课!
sun94510451 2004-12-05
  • 打赏
  • 举报
回复
来晚了,顶
sdts 2004-12-05
  • 打赏
  • 举报
回复
注意
---------------
》》》》》》》》》》》
--------------
分开的是两个页面 不要混了
hhjjhjhj 2004-12-05
  • 打赏
  • 举报
回复
你的数据库设计有问题,userimg表中设一个自动编码字段(id)
显示页面中:
rsuser.open "select * from userimg where userid='"&userid&"',conn,1,1
.......
do while not rsuser.eof
<img src="img.asp?id=<%=rsuser("id)%>">
rsuser.movenext
loop

img.asp中:
rs.open "select img from userimg where id="&request("id")&",conn,1,1
Response.ContentType="image/*"
Response.BinaryWrite rs("img").getChunk(7500000)


sdts 2004-12-05
  • 打赏
  • 举报
回复
你存的时候要为图片设立自动编号的id(就是说哪个id对应哪个图片)

以下代码不完整
-------------------------------这个显示单个图片
这个页叫display.asp
<%
response.expires=-9999
set connGraph=server.CreateObject("ADODB.connection")
connGraph.Open ....
response.clear
sql="select * from expinfo where eid=..."(比如说sql="select id,img from expinfo where id=1" 就是id号为1的图片)
set rs=connGraph.Execute(sql)
Response.ContentType = "text/html"
Response.BinaryWrite rs("img").getchunk(7500000)
rs.close
set rs=nothing
%>
---------------------------
》》》》》》
----------------用这个循环显示所有图片
rec.Open "SELECT id,img FROM img",connGraph,1,3
Response.write "共有"&rec.recordcount&"张图片<br>"
Do while not rec.eof
Response.write "<img src='display.asp?id="&rec("id")&"' height=100 width=100><br>"
rec.movenext
Loop
rec.close
set rec=nothing
-----------------------------------
supersual 2004-12-05
  • 打赏
  • 举报
回复
我是通过用户ID来查找的

rs.open "select * from userimg where userid='"&userid&"',conn,1,1
Response.ContentType="image/*"
Response.BinaryWrite rs("img").getChunk(7500000)

我知道rs里有很多记录,可我就是不能把它读到一张网页上?

hhjjhjhj 2004-12-05
  • 打赏
  • 举报
回复
<img src="img.asp?id=1">
<img src="img.asp?id=2">
.........
supersual 2004-12-05
  • 打赏
  • 举报
回复
我在做一个数码照片网上冲印系统,所以这是难免的,大家帮帮忙啊!!!!

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧