ASP instance: 6 lines of code implementation without component upload

zhaozj2021-02-16  56

There are currently a lot of components, I'm looking for it, most of them are quite complicated, some actually can only pass the text.

The most critical is that there is no 10 line code :)

I spent a night to study Adodb.Stream, and used 6 lines of code to implement no component upload:

strFileName = Request.QueryString ( "file1") Set objStream = Server.CreateObject ( "ADODB.Stream") objStream.Type = 1 'adTypeBinary objStream.Open objStream.LoadFromFile strFileName objStream.SaveToFile Server. "123_onweb.gif", 2

Instructions:

Write the above code into upgrad.asp Inside the browser: http: //xxx/upload.asp? File1 = C: / upload file /123.gif xxx For your host address, you will see you. There are more 123_onweb.gif in the directory. He is you want to pull! ! ! !

According to the principles we can extend the following code: UPLOAD.ASP file <% Function getFileName (Byval strfile) if strfile <> "" "" "" "/") 1) Else getFileName = "" END IF end function

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

转载请注明原文地址:https://www.9cbs.com/read-20672.html

New Post(0)