Some of the previously collected data---without the component upload file code specific examples

Source: Internet
Author: User
Tags contains client
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) & "&LT;/B&GT;, Length: <b>" & Logfn (field.length) & "&LT;/B&GT;, Content-type: <b>" & Logf (Field.contenttype) & "&LT;/B&GT;, 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>
&LT;TR&GT;&LT;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>
&LT;TD&GT;&LT;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



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.