分享
 
 
 

ASP中以二进制将图片存入XML文件中

王朝asp·作者佚名  2006-12-16
窄屏简体版  字體: |||超大  

文件一:将图形文件存入XML文件中..

文件名: imagetoxml.asp

<%

Option Explicit

dim xml

Dim objStream

Dim objXMLDoc

''定义变量完结

'创建对像

Set objXMLDoc = Server.CreateObject("Msxml2.DOMDocument.4.0")

'设定生成XML文档的根为 Base64Data

objXMLDoc.loadXML "<?xml version='1.0'?><Base64Data />"

'用 stream 来读取数据

Set objStream = Server.CreateObject("ADODB.Stream")

objStream.Type = 1

objStream.Open

objStream.LoadFromFile Server.MapPath("2.jpg")

'2.jpg要和这个文件放在同一目录下.

objXMLDoc.documentElement.dataType = "bin.base64"

objXMLDoc.documentElement.nodeTypedvalue = objStream.Read

'数据流读取结束.得到了值 objXMLDoc

'创建XML文件

Set xml = Server.CreateObject("Msxml2.DOMDocument.4.0")

xml.load objXMLDoc

xml.save (Server.MapPath("2.xml"))

'同样文件名也可以自定义

response.Write("成功")

%>

================================

文件二:把XML文件以图像的方式来显示

文件名:xmltoimage.asp

<%

Option Explicit

Dim objXMLDoc

'定义变量完结

Set objXMLDoc = Server.CreateObject("Msxml2.DOMDocument.4.0")

objXMLDoc.async = False

objXMLDoc.validateOnParse = True

'创建对象

If objXMLDoc.load (Server.MapPath("2.xml")) Then

'如果成功加载2.xml(这个名可以自己改保证在SERVER.MAPPATH的相对路径下)

Dim SigNode

Set SigNode = objXMLDoc.selectSingleNode("//Base64Data")

'读取图片对象

If SigNode Is Nothing Then

'如果图片没有找到

Else

Response.ContentType = "image/jpg"

Response.BinaryWrite SigNode.nodeTypedvalue

'Response.BinaryWrite 以二进制方式写出

End If

Else

'发生了错误.代码自己写.

End If

%>

末了.大家可以用ASP的随机数来读取不同的XML文档就OK了.

同时传上兔子的个人头像..感谢她上回给我的三个大学生XML论文

文件名:2.xml

<?xml version="1.0"?>

<Base64Data xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64">/9j/4AAQSkZJRgABAgA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9u2D7Kj0j+lmv9We42v3j

Ysm9IgkO9Xb/AFt3QefR/PA8wPZZ/mEK5/AB1O/1MOm/ALvl6268VXtV0lwd+2qkBs26f6fl

OrLsci1btpwpq0rC2M1RqjXCv4paGzTKreNfNS7gkxaFgemCBSaQuEmkhk0jyBEQIb6xqHMC

P9y+q+mqf2H7ie1jYPeSP0nTm6nXBY+ns6bpLTB61uoBunFS0LTKSyE0nQ2qF3uOQKXeo0+G

mH

[1] [2] 下一页

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有