-
ASP使用ASPupload组件上传多个文件的示例,ASPupload是一款专门在ASP环境下上传文件的一个组件,支持多文件上传,本教程主要是演示如何使用aspupload上传文件。测试前,请确保你已安装了ASPupload,若还没有安装,你可在这里下载:AspUpload ASP上传组件 v3.0下载
下载后请双击安装到你的测试服务器上,下面来说一下如何使用。
请先建立以下文件上传表单文件:
01
<
HTML
>
02
<
TITLE
>ASP使用ASPupload组件上传多个文件的示例</
TITLE
>
03
<
BODY
BGCOLOR
=
"#FFFFFF"
>
04
<
CENTER
>
05
<
H2
>ASPupload组件上传多个文件</
H2
>
06
</
CENTER
>
07
<
FORM
METHOD
=
"POST"
ENCTYPE
=
"multipart/form-data"
ACTION
=
"Upload.asp"
>
08
文件1:<
INPUT
TYPE
=
FILE
NAME
=
"FILE1"
> <
BR
>
09
注释1:<
INPUT
TYPE
=
TEXT
NAME
=
"DESCR1"
><
BR
> <
BR
>
10
文件2:<
INPUT
TYPE
=
FILE
NAME
=
"FILE2"
> <
BR
>
11
注释2:<
INPUT
TYPE
=
TEXT
NAME
=
"DESCR2"
><
BR
> <
BR
>
12
<
CENTER
>
13
<
INPUT
TYPE
=
SUBMIT
VALUE
=
"上传"
>
14
<
INPUT
TYPE
=
RESET
VALUE
=
"清空"
>
15
</
CENTER
>
16
</
FORM
>
17
</
BODY
>
18
</
HTML
>
再建立一个接受表单内容的上传文件:upload.asp
01
<HTML>
02
<title>您要上传的文件为:</title>
03
<BODY>
04
<%
05
Set
Upload = Server.CreateObject(
"Persits.Upload.1"
)
06
Upload.Save
"D:\upload"
'文件上传的目录,可自行修改
07
%>
08
Files:<BR>
09
<%
10
For
Each
File in Upload.Files
11
Response.Write File.Name &
"= "
& File.Path &
" ("
& File.Size &
")<BR>"
12
Next
13
%>
14
<P>
15
Otheritems:<BR>
16
<%
17
For
Each
Item in Upload.Form
18
Response.Write Item.Name &
"= "
& Item.Value &
"<BR>"
19
Next
20
%>
21
</BODY>
22
</HTML>
如果你的aspupload安装正确,上述代码会通过Set Upload = Server.CreateObject("Persits.Upload.1") 生成上传对象,并依次获取需要上传的文件信息,最后逐一上传,简单吧?