The first example below is just an example of uploading a client's file to a server
The second example is to save the contents of a file into a database.
File fupload.asp
<%
Dim resulthtml
' Some value greater than default of 60s (according to upload size.)
' The maximum speed is about 100kb/s to IIS4, P200 and local upload, 4kb/s for modem users.
Server.ScriptTimeout = 400
If Request.ServerVariables ("request_method") = "post" Then ' Request method must is ' post ' for Get the ' fields
' Begintimer ' starts timer.
' ************************************************* Main Upload-start
Dim Fields
' On Error Resume Next
' Set upload limit to 10M
Uploadsizelimit = 10000000
' Gets uploaded fields
Set Fields = Getupload ()
' There are all of form fields in the Fields object. Example:
' Fields ("File1"). Contenttype-content Type of File1 field
' Fields ("File1"). Value-binary Value of File1 field
resulthtml = ""
If Err = 0 Then ' Upload was OK
' Write statistics about upload
Dim Field
For each Field in Fields.items
resulthtml = resulthtml & "<br>field: <b>" & Logf (field.name) & "</B>, Length: <b>" & Logfn (field.length) & "</B>, Content-type: <b>" & Logf (Field.contenttype) & "</B>, S Ourcefilename:?b> "& Logf (field.filename) &" </b> "
Next
' Saves the fields to the disk, writes the ' client and writes log.
' Utils.inc. Can change the function to save the files to another location.
resulthtml = resulthtml & "<BR>" & Saveupload (Fields, Server.MapPath ("."), LogFolder)
Else ' Error in upload. Write the error
resulthtml = resulthtml & "<br>error:" & Err.Description
End If
On Error GoTo 0
Fields = Empty ' Clear the variable
' ************************************************* Main upload-end
' EndTimer ' writes info about consumed time.
End If ' Request method must is ' POST '
%>
<% ' upload.inc, contains getupload function, Required for upload-only the one file%>
<!--#INCLUDE file= "Fupload.inc"-->
<% ' Utils.inc, contains saveupload function%>
<!--#INCLUDE file= "Futils.inc"-->
<% ' Format.inc, contains head and Foot function, optional.%>
<!--#INCLUDE file= "Fformat.inc"-->
<%=head ("Sample multiple binary files upload via ASP", demonstrates using the ByteArray class for working with Bina Ry data from Request.BinaryRead. ") %>
<Table>
<form method=post enctype= "Multipart/form-data" >
<tr bgcolor=silver><td></td><td align=right><input type= "Submit" Name= "Action" value= " Upload The files >> ></TD></TR>
<TR><TD colspan=2>
<table width=100% border=0 cellpadding=0 cellspacing=0><tr><td>
<div id=files>
File??? Input type= "file" Name= "File1" ><br>
File??? Input type= "file" name= "File2" >
</Div>
<TD><TD Align=right valign=top>
<a Style=cursor:hand Onclick=return (Expand ()) ><font Color=blue><u>add A File</u></font ></a>
</TD></TR></Table>
</TD></TR>
<tr><td>checkbox</td><td><input