当前位置: 首页 > 图文教程 > 网络编程 > ASP > 无组件图文混合上传示例

ASP
简单ASP论坛DIY
如何防止页面中的敏感信息被提取
asp创建对象及中文显示解决技巧
基础开发入门级:JSP与ASP的比较
数据库受到限制怎么办?
ASP初学者常犯的几个错误
Asp定时执行操作、Asp定时读取数据库(网页定时操作详解)
ASP优化:非常实用的ASP提速技巧五则
ASP教程:解决ASP脚本运行超时的方法
ASP安全:简单学习ASP连接数据库方法
简单一招用ASP实现对IE地址栏参数的判断
asp控制xml数据库的6段非常的经典代码
ASP进阶:验证身份证号是否正确的代码
ASP教程:使用ASP生成图片彩色校验码
ASP进阶:用ASP判断文件地址是否有效
ASP进阶:用asp做的简单搜索引擎代码
ASP实例 挂QQ的网页源代码ASP/PHP
ASP答疑 解决ASP脚本运行超时的方法
轻轻松松破解开别人ASP木马密码的方法
用ASP操作Access数据库 ADOX的使用

ASP 中的 无组件图文混合上传示例


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 42 ::
收藏到网摘: n/a

  以下代码没有规范,还有些功能没完成,有那位高手能把它修改一下,封装成类则更是造福大众,或者以后有时间我会做的。有任何错误或建议请一定要给我发E-mail:[email protected],谢谢。
  好了,少说多做,本示例在w2kServer,IIS5,SQL SERVER7中测试通过。
如有不明白的可到精华区查“图象”或“图片”关键字找到答案,或写信给我。
  示例一共有三个文件:upload.htm(上传界面)
process.asp(处理程序)
showimg.asp(显示图象)
数据库:在pubs数据库中建立一个新表名为imgtest
字段名    类型   长度
----------------------------------------------
id int (自动编号)
img iamge
imginfo nchar 50

以下是三个文件的代码:

upload.htm
---------------------------------------------------------------------
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
td { font-size: 9pt}
a { color: #000000; text-decoration: none}
a:hover { text-decoration: underline}
.tx { height: 16px; width: 30px; border-color: black black #000000; border-top-width: 0px;

border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; font-size: 9pt;

background-color: #eeeeee; color: #0000FF}
.bt { font-size: 9pt; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px;

border-left-width: 0px; height: 16px; width: 80px; background-color: #eeeeee; cursor: hand}
.tx1 { height: 20px; width: 30px; font-size: 9pt; border: 1px solid; border-color: black black

#000000; color: #0000FF}
-->
</style>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="process.asp" enctype="multipart/form-data" >
<table width="71%" border="1" cellspacing="0" cellpadding="5" align="center"

bordercolordark="#CCCCCC" bordercolorlight="#000000">
<tr bgcolor="#CCCCCC">
<td height="22" align="left" valign="middle" bgcolor="#CCCCCC"> Sobina
的图文上传界面</td>
</tr>
<tr align="left" valign="middle" bgcolor="#eeeeee">
<td bgcolor="#eeeeee"> <br>
</td>
</tr>
<tr align="center" valign="middle">
<td align="left" id="upid" height="122">
<p>图象路径:
<input type="file" name="img" style="width:400" class="tx1" value="">
</p>
<p>图象说明:
<input type="text" name="imginfo">
</p>
</td>
</tr>
<tr align="center" valign="middle" bgcolor="#eeeeee">
<td bgcolor="#eeeeee" height="2">
<input type="submit" name="Submit" value="· 提交 ·" class="bt">
<input type="reset" name="Submit2" value="· 重置 ·" class="bt">
</td>
</tr>
</table>
</form>
</body>
</html>
------------------------------------------------------------------------
process.asp
------------------------------------------------------------------------
<!--#include file="../bin/strCnn.asp"-->
<%
response.expires=0
'目的:将二进制字符转换成普通字符
Function bin2str(binstr)
Dim varlen,clow,ccc,skipflag
skipflag=0
ccc = ""
varlen=LenB(binstr)
For i=1 To varlen
If skipflag=0 Then
clow = MidB(binstr,i,1)
If AscB(clow) > 127 Then
ccc =ccc & Chr(AscW(MidB(binstr,i+1,1) & clow))
skipflag=1
Else
ccc = ccc & Chr(AscB(clow))
End If
Else
skipflag=0
End I