I was spent time studied night ADODB.Stream, and used 6 code came true to upload without package:
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
Use method:
Write the code above into Upload.asp
Input inside the browser:
Http://XXX/upload.asp? File1=c:\Upload file \123.gif
XXX is your lead plane address
Below the list that after be being carried out, you can see you much a 123_onweb.gif
He is you want a file to pull! ! ! !
According to the principle we can expand the following code:
Upload.asp file
< %
Function GetFileName(ByVal StrFile)
“” Then of > of < of If StrFile
GetFileName = Mid(strFile, inStrRev(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
> of < Form Name=”FORM” Action=”upload.asp” Method=”post”
> of < Input Type=”submit” Name=”submit” Value=”OK”
< Input Type=”file” Name=”file1″ Style=”width:400″ Value=”" >
< / Form >
