Thinking of enterprise system architecture-(Speed chapter)

Source: Internet
Author: User
Architecture | Speed Upload file

1. Upload page

<form name= "form" action= "upload.asp" method= "POST" >
<input type= "Submit" name= "Submit" value= "OK" >
<input type= "File" Name= "File1" style= "width:400" "value=" ">
</form>

2. Data upload exercise (upload.asp) page

<% Language=vbscript%>
<%
Call UpLoad
'**********************************************************************
Private Function GetFileName (ByVal strfile)
' This function is used to get the name of the uploaded file
If strfile <> "" Then
GetFileName = Mid (Strfile,instrrev (strfile, "\") +1)
Else
GetFileName = ""
End If
End Function
'************************************************************************
Private Sub UpLoad ()
On Error Resume Next
' Code to execute the uploaded file
strFileName = Request.Form ("File1")
Set objstream = Server.CreateObject ("ADODB. Stream ")
objStream.Type = 1 ' adtypebinary
objStream.Open
objStream.LoadFromFile strFileName
' Save file to server
Objstream.savetofile "D:\download\" & GetFileName (strFileName), 2
objStream.Close

If Err = 0 Then
Response.Write "Upload success!"
Else
Response.Write "Upload failed!"
End If

Set objstream = Nothing
End Sub
'**************************************************************************
%>





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.