There are a lot of non-component upload class, I probably looked at a bit, most of the writing is quite complex, some incredibly still can only pass text, the most critical is not 10 lines of code below:), I spent a night to study the ADODB.stream, and 6 lines of code to implement the component-free upload:
Upload.asp file Code
<%
strFileName = Request.QueryString ("FN")
Set objstream = Server.CreateObject ("ADODB. Stream ")
objStream.Type = 1 ' adtypebinary binary mode
objStream.Open
objStream.LoadFromFile strFileName
Objstream.savetofile Server.MapPath ("Zslogo.gif"), 2
%>
Use the method
in the browser input:
Http://xxx/upload.asp?fn=c :/upload file/123.gif
where xxx is your website domain address, such as: Www.jzxue.com
After you have finished executing you will see a zslogo.gif under your directory, that is, you just uploaded the file pull.
based on ASP's no-component upload principle, we extend the above code to the following code:
upload.asp File code
<%
Function getfilename (ByVal fn)
If fn<> "" Then Getfilename=mid (Fn,instrrev (FN, "/") +1) Else getfilename= ""
Endfunction
strFileName = Request.Form ("file1")
Set objstream = Server.CreateObject ("ADODB. Stream ")
objStream.Type = 1 ' adtypebinary
objStream.Open
objStream.LoadFromFile strFileName
Objstream.savetofile Server.MapPath (GetFileName (strFileName)), 2
objStream.Close
%>
upload.htm File code
<form name= "Upform" action= "upload.asp" method= "post" enctype= "Multipart/form-data";
<input type= " File "Name=" File1 "style=" width:400px "value=" "/>"
<input type= "Submit" name= "submit" value= "Upload file"/>
</form>