ASP No component Upload

Source: Internet
Author: User
ASP No component Upload

Description: Collect a part from the Internet and write it yourself. The main promotion is the form of binary data for the class encapsulation, you can easily get the information of the elements within the form.

Form binary Data format:

Split Flag Data + 0x0d0a
Element description Information + 0x0d0a0d0a
Element content Data + 0x0d0a

Split Flag Data + 0x0d0a
Element description Information + 0x0d0a0d0a
Element content Data + 0x0d0a

......

Split Flag Data + 0x0d0a


1. Upload.htm

<body>
<form enctype= "Multipart/form-data" action= "upload.asp" method= "POST" >
<input name= "text0" type=text value= "text box" ><br>
<input name= "file1" Type=file accept= "image/*" ><br>
<input name= "file2" Type=file accept= "image/*" ><br>
<input type=submit value= "Upload" >
</form>
</body>

2. upload.asp
<!--#include file= "Upload.inc"-->
<%
' By Sam 2004,6
'###############################################################################
Response.Expires = 0

If Request.ServerVariables ("request_method") = "POST" Then
Response.Clear ()
Response.buffer=true

Set uform = new Uploadform
Uform.find_element "Text0"

data = MidB (Uform.formdata,uform.datastart,uform.datalen)
Response.BinaryWrite data
Sdata = binarytostring (data)
Response.Write Sdata
Response.BinaryWrite Stringtobinary (sdata)




Uform.find_element "File1"
SaveFile Server.MapPath ("/recv1.dat"), Uform.formdata,uform.datastart,uform.datalen

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.