⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.html

📁 asp上传组件。在ASP设计过程中
💻 HTML
字号:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
a {  color: #0000FF; text-decoration: underline}
a:hover {  color: #FF0000; text-decoration: underline}
-->
</style>
</head>

<body bgcolor="#FFFAF7" text="#000000">
<br>
<font size="3"><br>
</font>
<table width="65%" border="1" cellspacing="0" cellpadding="5" bordercolordark="#CCCCCC" bordercolorlight="#000000" align="center">
  <tr bgcolor="#F6F6F6"> 
    
<td colspan="3" height="107" align="center" valign="middle"><b><font size="3" color="#000000">化境ASP无组件上传类 
- upload_5xsoft 使用手册 2.0<br>
</font></b><font size="3" color="#000000">&nbsp; </font><font size="2"><br>
<a href="http://www.5xsoft.com/">http://www.5xsoft.com/</a> [ <a href="upclass.zip">下载</a> 
]</font></td>
  </tr>
</table>
<font size="3"><br>
<br>
<br>
<br>
</font> 
<table width="22%" border="1" cellspacing="0" cellpadding="3" bordercolordark="#CCCCCC" bordercolorlight="#000000">
  <tr align="left" valign="middle"> 
    <td height="16" width="14%" bgcolor="#CCCCCC">&nbsp;</td>
    <td height="16" width="86%" bgcolor="#F6F6F6"><font color="#000000" size="2">目 
      录</font></td>
  </tr>
</table>
<p>1.<a href="#new">What's New?</a><br>
<br>
2.<a href="#about">关于 upload_5xsoft</a><br>
<br>
3.<a href="#note">运行平台与注意事项</a><br>
<br>
4.<a href="#form">如何得到表单数据</a><br>
<br>
5.<a href="#file">如何得到文件数据</a></p>
<p>6.<a href="#class">类的成员与对象</a></p>
<p>7.<a href="#example">使用示例</a></p>
<a name="about"></a><br>
<table width="22%" border="1" cellspacing="0" cellpadding="3" bordercolordark="#CCCCCC" bordercolorlight="#000000">
<tr align="left" valign="middle"> 
<td height="16" width="14%" bgcolor="#CCCCCC">&nbsp;</td>
<td height="16" width="86%" bgcolor="#F6F6F6"><font color="#000000" size="2">what's 
new </font></td>
</tr>
</table>
<p><br>
1.使用了新的处理方式, 提供的高效的处理方式,上传速度可提高一倍以上,可上传更大的文件。<br>
<br>
2.添加了form 方法和file方法,把原来的 form 集和 file改为 objForm 和 objFile,避免了若上传时没有数据会出错的Bug。<br>
<br>
3.对多选框的优化,上传同名的多选框时,会自动用 &quot;, &quot; 连接起来。<br>
<br>
4.对于表单名,不再区分大小写,使用ASP使用者更习惯。</p>
<p> <br>
<br>
<a name="about"></a></p>
<table width="22%" border="1" cellspacing="0" cellpadding="3" bordercolordark="#CCCCCC" bordercolorlight="#000000">
  <tr align="left" valign="middle"> 
    <td height="16" width="14%" bgcolor="#CCCCCC">&nbsp;</td>
    <td height="16" width="86%" bgcolor="#F6F6F6"><font color="#000000" size="2">关于 
      upload_5xsoft</font></td>
  </tr>
</table>
<p><font color="#FF0000"><br>
</font> 一直以来,由于FileSystemObject的局限,所以ASP最大的难题就是文件上传,大多解决法就是安装<br>
<br>
第三方上传组件。可第三方组件有很多问题,有的组件要注册,有的组件要在表单中加上他的版权信息。<br>
<br>
还有的就是组件的兼容问题。<br>
<br>
&nbsp; &nbsp;在网上也流传了很多无组件上传的代码,但都是只能上传文本文件,或是只能将文件上传到数据库中。<br>
<br>
我这段时间在研究ASP,发现可以不用第三方组件上传任意类型的文件。就写了这个类,给大家一<br>
<br>
个方便,整个类放在一个文件中: <font color="#0000FF">upload_5xsoft.inc </font>在<font color="#0000FF"> 
Example</font> 目录下还有一个完整的多文件上传示<br>
<br>
例程序,可以直接使用。<br>
<br>
<font color="#0000FF">申明:源代码是完全开放的,可能随意传播,但请保留其完整性,未经作者同意,不得用于商业。</font><br>
<br>
<br>
</p>
<a name="note"></a>
<table width="21%" border="1" cellspacing="0" cellpadding="3" bordercolordark="#CCCCCC" bordercolorlight="#000000">
  <tr align="left" valign="middle"> 
    <td height="16" width="15%" bgcolor="#CCCCCC">&nbsp;</td>
    <td height="16" width="85%" bgcolor="#F6F6F6"><font color="#000000" size="2">运行平台与注意事项</font></td>
  </tr>
</table>
<p>a)可直接运行于 Windows2000+IIS 5<br>
NT4 或是 Win98+PWS, 要安装ADO2.6 下载地址:<a href="http://www.microsoft.com/data/" target="_blank">http://www.microsoft.com/data/</a>:<br>
<font color="#0000FF">&lt;!--#include FILE=&quot;upload_5xsoft.inc&quot;--&gt;</font> 
就行了<br>
<br>
<br>
b) 在使用文件上传时, 表单 form 要加上 enctype=&quot;multipart/form-data&quot; 即:<br>
<br>
<font color="#0000FF">&lt;form name=&quot;form1&quot; method=&quot;post&quot; 
action=&quot;&quot; enctype=&quot;multipart/form-data&quot;&gt;<br>
&lt;input type=&quot;text&quot; value=&quot;abc&quot; name=&quot;text1&quot;&gt;<br>
&lt;input type=file name=&quot;file&quot;&gt;<br>
&lt;input type=submit name=&quot;submit&quot; value=&quot;提交&quot;&gt; <br>
&lt;/form&gt;</font><br>
<br>
<br>
</p>
<a name="class"></a>
<table width="23%" border="1" cellspacing="0" cellpadding="3" bordercolordark="#CCCCCC" bordercolorlight="#000000">
  <tr align="left" valign="middle"> 
    <td height="16" width="13%" bgcolor="#CCCCCC">&nbsp;</td>
    <td height="16" width="87%" bgcolor="#F6F6F6"><font color="#000000" size="2">upload_5xsoft的对象</font></td>
  </tr>
</table>
<p>如定义一个上传对象<font color="#0000FF"><br>
  &lt;!--#include FILE=&quot;upload_5xsoft.inc&quot;--&gt; <br>
  &lt;%<br>
  set upload=new upload_5xsoft 'upload就是一个对象<br>
  %&gt;</font></p>
<table width="96%" border="1" cellspacing="0" cellpadding="10" bordercolordark="#CCCCCC" bordercolorlight="#000000">
<tr> 
<td height="24" colspan="3" bgcolor="#F6F6F6"><font size="2">upload_5xsoft 对象成员</font></td>
</tr>
<tr> 
<td height="53">File</td>
<td height="53" colspan="2">方法,得到文件对象,例如:<font color="#0000FF">set file=upload.file(&quot;file1&quot;)</font><br>
<br>
文件对象成员下面有说明</td>
</tr>
<tr align="left" valign="top"> 
<td rowspan="9">objFile</td>
<td height="41" colspan="2">文件对象集,(是个dictionary对象)<br> </td>
</tr>
<tr align="left" valign="top"> 
<td height="20" colspan="2">文件对象成员:</td>
</tr>
<tr align="left" valign="top"> 
<td height="20" width="17%">Count</td>
<td height="20" width="66%">属性,文件表单的个数</td>
</tr>
<tr align="left" valign="top"> 
<td height="20" width="17%">FileName</td>
<td height="20" width="66%">属性,上传文件的名字</td>
</tr>
<tr align="left" valign="top"> 
<td height="20" width="17%">FileSize</td>
<td height="20" width="66%">属性,上传文件的大小(为0是表示没有文件)</td>
</tr>
<tr align="left" valign="top"> 
<td height="20" width="17%">FilePath</td>
<td height="20" width="66%">属性,上传前文件所在的路径</td>
</tr>
<tr align="left" valign="top"> 
<td height="20" width="17%">FormName</td>
<td height="20" width="66%">属性,文件表单的名字</td>
</tr>
<tr align="left" valign="top"> 
<td height="19" width="17%">SaveAs</td>
<td height="19" width="66%">方法,储存上传后文件,有一个参数,路径要为真实路径如:</td>
</tr>
<tr align="left" valign="top"> 
<td height="118" width="17%">例子:</td>
<td height="118" width="66%"><font color="#0000FF">set file=upload.file(&quot;file1&quot;) 
'file1为表单名<br>
<br>
response.write &quot;&lt;br&gt;文件名:&quot;&amp;file.FileName<br>
<br>
response.write &quot;&lt;br&gt;文件大小:&quot;&amp;file.FileSize<br>
<br>
response.write &quot;&lt;br&gt;文件路径:&quot;&amp;file.FilePath<br>
<br>
file.saveAs Server.mappath(&quot;/1.jpg&quot;)<br>
<br>
set file=nothing</font></td>
</tr>
<tr> 
<td height="24">Form</td>
<td height="24" colspan="2">方法,获得表单数据,如 <font color="#0000FF">Response.Write upload.Form(&quot;abc&quot;)</font></td>
</tr>
<tr align="left" valign="top"> 
<td height="86" rowspan="5">objForm</td>
<td height="20" colspan="2">表单数据集,(是个dictionary对象)用来代替 Request.Form</td>
</tr>
<tr align="left" valign="top"> 
<td height="20">count</td>
<td height="20">属性,表单数</td>
</tr>
<tr align="left" valign="top"> 
<td height="20">exists</td>
<td height="20">方法,检查是否有指定的表单名</td>
</tr>
<tr align="left" valign="top"> 
<td height="9" colspan="2">更多的用法可看 vbscript 的dictionary对象帮助</td>
</tr>
<tr align="left" valign="top"> 
<td height="108">例子:</td>
<td height="108"><font color="#0000FF"><a name="form"></a><br>
'得到text1表单的数据,uplaod就是一开始创建的对象<br>
<br>
sText=upload.form(&quot;text1&quot;) </font></td>
</tr>
<tr align="left" valign="top"> 
<td height="86">Version</td>
<td height="108" colspan="2">属性,upload_5xsoft类的版本号,如:<br> <font color="#0000FF"><br>
response.write upload.Version</font></td>
</tr>
</table>
<p> <br>
</p>
<a name="example"></a>
<table width="23%" border="1" cellspacing="0" cellpadding="3" bordercolordark="#CCCCCC" bordercolorlight="#000000">
  <tr align="left" valign="middle"> 
    <td height="16" width="13%" bgcolor="#CCCCCC">&nbsp;</td>
    <td height="16" width="87%" bgcolor="#F6F6F6"><font color="#000000" size="2">使用示例</font></td>
  </tr>
</table>
<p>1.上传一个jpg文件的示例:<br>
  <br>
  文件1: upload.htm</p>
<font color="#0000FF">&lt;html&gt;&lt;title&gt;example&lt;/title&gt;<br>
&lt;body&gt;<br>
&lt;form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;upload.asp&quot; 
enctype=&quot;multipart/form-data&quot;&gt;<br>
&lt;input type=file name=&quot;file1&quot;&gt;<br>
&lt;input type=submit name=&quot;submit&quot; value=&quot;提交&quot;&gt;<br>
&lt;/form&gt;<br>
&lt;/body&gt; <br>
&lt;/html&gt;<br>
<br>
<font color="#000000">文件2: upload.asp</font><br>
<br>
&lt;html&gt;&lt;title&gt;example&lt;/title&gt;<br>
&lt;body&gt;<br>
&lt;!--#include FILE=&quot;upload_5xsoft.inc&quot;--&gt; <br>
&lt;%<br>
set upload=new upload_5xsoft<br>
set file=upload.file(&quot;file1&quot;)<br>
response.write upload.form(&quot;submit&quot;)&amp;&quot;&lt;br&gt;&quot;<br>
if file.fileSize&gt;0 then<br>
&nbsp;file.saveAs Server.mappath(&quot;temp.jpg&quot;)<br>
&nbsp;response.write &quot;&lt;br&gt;上传文件:&quot;&amp;file.FileName&amp;&quot; 
=&gt; temp.jpg OK!&quot;<br>
&nbsp;response.write &quot;&lt;br&gt;文件大小:&quot;&amp;file.FileSize<br>
end if<br>
set file=nothing<br>
set upload=nothing<br>
%&gt;&lt;/body&gt; <br>
&lt;/html&gt;<br>
<br>
<font color="#000000">2.列表出有文件表单(多文件上传)</font><br>
<font color="#0000FF">&lt;html&gt;&lt;title&gt;example&lt;/title&gt;<br>
&lt;body&gt;<br>
&lt;!--#include FILE=&quot;upload_5xsoft.inc&quot;--&gt; <br>
&lt;%<br>
set upload=new upload_5xsoft<br>
<font color="#0000FF"><br>
''列出所有form数据</font><br>
for each formName in upload.objForm <br>
response.write formName&amp;&quot;=&quot;&amp;upload.objForm(formName)&amp;&quot;&lt;br&gt;&quot;<br>
next<br>
<br>
<font color="#0000FF"><font color="#0000FF">''列出所有文件</font></font><br>
for each formName in upload.objFile<br>
&nbsp;set file=upload.objFile(formName)<br>
&nbsp;if file.FileSize&gt;0 then<br>
&nbsp;&nbsp;file.SaveAs Server.mappath(file.FileName) <br>
&nbsp;&nbsp;response.write file.FilePath&amp;file.FileName&amp;&quot; (&quot;&amp;file.FileSize&amp;&quot;) 
=&gt; &quot;<br>
&nbsp;&nbsp;response.write file.FileName&amp;&quot; 成功!&lt;br&gt;&quot;<br>
&nbsp;end if<br>
&nbsp;set file=nothing<br>
next<br>
set upload=nothing<br>
%&gt; <br>
<br>
</font></font> <br>
你还可能直接使用作者写好了的上传程序在example目录中<br>
<br>
<a href="upclass.zip">立即下载</a><br>
<br>
若程序有问题,请写作者联系 <a href="mailto:getc@163.com">getc@163.com</a><br>
<div align=right>稻香老农 2003年 1月8日</div>
</body>
</html>
<xmp style="visibility:hidden">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -