Non-component file upload supporting Chinese-example

Source: Internet
Author: User
Upload | sample | No component | Chinese file: uploadtest.asp
<title>untitled document</title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">

<body bgcolor= "#FFFFFF" >
<form method= "Post" Name= "Form1" enctype= "Multipart/form-data" action= "showdata.asp" >
&LT;P&GT;TEXT1:
<input type= "text" name= "Text1" >
</p>
&LT;P&GT;TEXT2:
<input type= "text" name= "Text2" >
</p>
<p>txtarea:
<textarea name= "TextField" cols= "rows=" ></textarea>
</p>
<p>file:
<input type= "File" name= "NewFile" >
</p>
<p>
<input type= "Submit" name= "submit" value= "Submit" >
<input type= "reset" name= "reset" value= "reset" >
</p>
</form>
</body>

File: showdata.asp
<!--#INCLUDE file= "Upload.inc"-->
<%
' Fields ("xxx"). Name gets the names of xxx (form Object) in form
' Fields ("xxx"). FilePath if it is the file Object that gets the full path
' Fields ("xxx"). FileName gets file name if it is file Object
' Fields ("xxx"). ContentType if it is file Object to get the type
' Fields ("xxx"). Length gets the data lengths of xxx (Form Object) in form
' Fields ("xxx"). Value gets the data content of xxx (form Object) in form
Dim formdata,formsize
Formsize=request.totalbytes
Formdata=request.binaryread (Formsize)
Set Fields = getupload (FormData)
Response.Write "Text1:" & Fields ("Text1"). Value & "<br>" & VbCrLf
Response.Write "Text2:" & Fields ("Text2"). Value & "<br>" & VbCrLf
Response.Write "TEXTAREA:" & Fields ("TextField"). Value & "<br>" & VbCrLf
Response.Write Fields ("NewFile"). FileName
Response.Write Fields ("NewFile"). ContentType
Response.ContentType = Fields ("NewFile"). ContentType
If Fields ("NewFile"). Filename<> "" Then
Response.ContentType = Fields ("NewFile"). ContentType
Response.BinaryWrite Fields ("NewFile"). Value
End If

' Response.BinaryWrite FormData
%>



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.