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
'**************************************************************************
%>