日期:2013-03-31  浏览次数:20792 次

'#####################################################################
'备注:我没有验证,提供给大家一种参考!请大家自行验证
'欢迎大家发表你认为好的精彩程序代码
'大风(xuankong) 2000。12。8
'#####################################################################
标题:还是用我的无组件文件上载吧,与ASPCN组件有异曲同工之妙,下面是例程:
作者:DUDU(DUSJ)
时间:2000-12-7 上午 09:48:00
阅读次数:8
详细信息:
-----------------------------
表单填写页的内容:
-----------------------------
<html>
<head>
<meta name="Author" content="Sander Duivestein">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>将本地的文件上载到数据库</title>
</head>
<body>
<font size="2" size="2"><br>
</font>
<form name="frmUpload" method="post" enctype="multipart/form-data" action="Upload.asp">
<table cellspacing="0" cellpadding="0" width="490">
<tr>
<td width="167">
<p align="right"><font size="2" size="2">请选择文件:</font></p>
</td>
<td width="319"><font size="2" size="2"><input type="file" name="vFileName"></font></td>
</tr>
<tr>
<td align="right" width="167"><font size="2" size="2">文件说明1:</font></td>
<td width="319"><input name="shuoming" size="32" ></font></td>
</tr>
<tr>
<td align="right" width="167"><font size="2" size="2">文件说明2:</font></td>
<td width="319"><input name="shuoming_2" size="32" onchange="isdate1(document.frmUpload.dengji)" </td>
</tr>
<td width="167"></td>
<td width="319">
<p align="left"><font size="2" size="1"><input type="submit" style="background-image: url('images/back.jpg'); cursor: hand; font-sizd: smaller; left: 0px; width: 94; top: 5px; height: 25" value=" 上 载 " style="background-image: url('images/back.jpg'); cursor: hand; font-sizd: smaller; left: 0px; width: 94; top: 5px; height: 25" size="23" ></font></p>
</td>
<tr>
<td colspan="2" align="right" width="487"></td>
</tr>
</table>
</form>
</body>

</html>

----------------------------------
Upload.asp的内容:
----------------------------------
<%
Response.Buffer = TRUE
Response.Clear
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
'response.binarywrite requestbin
'取得表单的全部内容
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
' UploadRequest结构将用来存放表单

PosBeg = 1
PosEnd = InstrB(PosBeg,RequestBin,StoB(chr(13)))
boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
'求字段间的分隔串(即:-----------------------------7d029e347d8 )
boundaryPos = InstrB(1,RequestBin,boundary)

Do until (boundaryPos=InstrB(RequestBin,boundary & StoB("--")))
'Members variable of objects are put in a dictionary object
Dim UploadControl
Set UploadControl = CreateObject("Scripting.Dictionar