首页 > 代码库 > ShotGraph例程
ShotGraph例程
下面是HTML文件用于上传3个文件
<blockquote>
<p><HTML> <br>
<BODY BGCOLOR="#FFFFFF"> <br>
<FORM METHOD="POST" ENCTYPE="multipart/form-data"
ACTION="Upload.asp"> <br>
<INPUT TYPE=FILE NAME="FILE1"><BR> <br>
<INPUT TYPE=FILE NAME="FILE2"><BR> <br>
<INPUT TYPE=FILE NAME="FILE3"><BR> <br>
<br>
<INPUT TYPE=TEXT NAME="DESCRIPTION"><BR> <br>
<br>
<SELECT NAME="CATEGORY" MULTIPLE><br>
<OPTION>Image<br>
<OPTION>Text<br>
<OPTION>Source Code<br>
<OPTION>Archive<br>
</SELECT><BR><br>
<br>
<INPUT TYPE=SUBMIT VALUE=http://www.mamicode.com/"Upload!">
</FORM> <br>
</BODY> <br>
</HTML> <br>
</font></p>
</blockquote>
上传程序(Upload.asp):
< %
Set Upload = Server.CreateObject("Persits.Upload.1")
‘ Upload files
Upload.OverwriteFiles = False ‘ Generate unique names
Upload.SetMaxSize 1048576 ‘ Truncate files above 1MB
Upload.Save "c:\upload"
‘ Process all files received
For Each File in Upload.Files
‘ Save in the database as blob
File.ToDatabase "DSN=data;UID=sa;PWD=zzz;", _
"insert into mytable(blob) values(?)"
‘ Move to a different location
File.Copy "d:\archive\" & File.ExtractFileName
File.Delete
Next
‘ Display description field
Response.Write Upload.Form("Description") & "
"
‘ Display all selected categories
For Each Item in Upload.Form
If Item.Name = "Category" Then
Response.Write Item.Value & "
"
End If
Next
% >