无组件上传文件(2)
发表于:2007-06-30来源:作者:点击数:
标签:
outputfile.asp % ‘’ Author Philippe Collignon ‘’ Email PhCollignon@email.com Response.Expires=0 Response.Buffer = TRUE Response.Clear ‘’Response.BinaryWrite(Request.BinaryRead(Request.TotalBytes)) byteCount = Request.TotalBytes ‘’Re
outputfile.asp
<%
‘’ Author Philippe Collignon
‘’ Email PhCollignon@email.com
Response.Expires=0
Response.Buffer = TRUE
Response.Clear
‘’Response.BinaryWrite(Request.BinaryRead(Request.TotalBytes))
byteCount = Request.TotalBytes
‘’Response.BinaryWrite(Request.BinaryRead(varByteCount))
RequestBin = Request.BinaryRead(byteCount)
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin
email = UploadRequest.Item("email").Item("Value")
contentType = UploadRequest.Item("blob").Item("ContentType")
filepathname = UploadRequest.Item("blob").Item("FileName")
filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,""))
value = UploadRequest.Item("blob").Item("Value")
‘’Create FileSytemObject Component
Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
‘’Create and Write to a File
pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14
Set MyFile = ScriptObject.CreateTextFile(Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd)&"uploaded"&filename)
For i = 1 to LenB(value)
MyFile.Write chr(AscB(MidB(value,i,1)))
Next
MyFile.Close
%>
<b>Uploaded file : </b><%="uploaded"&filename%><BR>
<img src="<%="uploaded"&filename%>">
<!--#include file="upload.asp"-->
转自asptoday
原文转自:http://www.ltesting.net