ASP使用ASPupload组件上传多个文件的示例,ASPupload是一款专门在ASP环境下上传文件的一个组件,支持多文件上传,本教程主要是演示如何使用aspupload上传文件。测试前,请确保你已安装了ASPupload,若还没有安装,你可在这里下载:AspUpload
ASP上传组件 v3.0下载
下载后请双击安装到你的测试服务器上,下面来说一下如何使用。
请先建立以下文件上传表单文件:
02 |
< TITLE >ASP使用ASPupload组件上传多个文件的示例</ TITLE > |
03 |
< BODY BGCOLOR = "#FFFFFF" > |
05 |
< H2 >ASPupload组件上传多个文件</ H2 > |
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 > |
13 |
< INPUT TYPE = SUBMIT VALUE = "上传" > |
14 |
< INPUT TYPE = RESET VALUE = "清空" > |
再建立一个接受表单内容的上传文件:upload.asp
02 |
<title>您要上传的文件为:</title> |
05 |
Set Upload
= Server.CreateObject( "Persits.Upload.1" ) |
06 |
Upload.Save "D:\upload" |
10 |
For Each File
in Upload.Files |
11 |
Response.Write
File.Name & "=
" &
File.Path & "
(" &
File.Size & ")<BR>" |
17 |
For Each Item
in Upload.Form |
18 |
Response.Write
Item.Name & "=
" &
Item.Value & "<BR>" |
如果你的aspupload安装正确,上述代码会通过Set Upload = Server.CreateObject("Persits.Upload.1") 生成上传对象,并依次获取需要上传的文件信息,最后逐一上传,简单吧?