|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
写软件都是想的时间比写的时间要长的.如果反过来了就得看看是什么原因了.另外大家可以回去问问公司里的小MM.(一般企业里,跟你们交付软件接触得最多的是她们)<!--#includefile="../lib/filelib.asp"-->
<%
Response.write"<title>上传文件至以后文件夹</title>"
Response.Write"<bodybgcolor=""#D6D3CE""leftmargin=""0""topmargin=""0""title=""请您恪守国度相干功令律例上传文件。上传前请杀毒,不然体系将会主动删除此文件!"">"
**StartEncode**
Action=Request("A")
IfAction="UL"Then
DoUploadRequest.Cookies("DAZHOU.NET")("nowpath")&""
CheckDiskSpace
Response.redirect"fileman.asp"
Else
ShowUploadForm
EndIf
Setfso=Nothing
========================
SUBShowUploadForm
========================
Response.write"<Dir><formenctype=multipart/form-dataname=fmuploadmethod=Postaction=Upload.asp?A=UL><br>"
IfRequest("n")""ANDIsNumeric(Request("n"))ThenSession("NumUploadFields")=CInt(Request("n"))
Fori=1to5
Response.Write"<INPUTtype=filename=file"&i&"size=35><br>"
Next
Response.Write"<br><center><INPUTtype=submitvalue=""入手下手上传""><INPUTtype=buttonvalue=作废上传>"
Response.Write"</form>"
EndSUB
========================
SUBDoUpload(Dir)
========================
IfNOTApplication("Debugging")ThenOnErrorresumenext
StartTime=Now
RequestBin=Request.BinaryRead(Request.TotalBytes)
SetUploadRequest=CreateObject("Scripting.Dictionary")
BuildUploadRequestRequestBin,UploadRequest
keys=UploadRequest.Keys
Fori=0toUploadRequest.Count-1
curKey=keys(i)
fName=UploadRequest.Item(curKey).Item("FileName")
Iffso.FileExists(Dir&fName)Thenfso.deletefileDir&fName
IffName""ANDNOTfso.FileExists(Dir&fName)Then
value=UploadRequest.Item(curKey).Item("Value")
valueBeg=UploadRequest.Item(curKey).Item("ValueBeg")
valueLen=UploadRequest.Item(curKey).Item("ValueLen")
TotalULSize=TotalULSize+valueLen
Setstrm1=Server.CreateObject("ADODB.Stream")
Setstrm2=Server.CreateObject("ADODB.Stream")
strm1.Open
strm1.Type=1Binary
strm2.Open
strm2.Type=1Binary
strm1.WriteRequestBin
strm1.Position=ValueBeg
strm1.CopyTostrm2,ValueLen
strm2.SaveToFileDir&fName,2
Setstrm1=Nothing
Setstrm2=Nothing
EndIf
Next
IfNow>StartTimeThenResponse.Write("<br><br><br><br><center>上传乐成!<br>速率:"&Round(TotalULSize/1024/DateDiff("s",StartTime,Now))&"千字节/秒")
SetUploadRequest=Nothing
EndSUB
========================
SubBuildUploadRequest(RequestBin,UploadRequest)
========================
Gettheboundary
PosBeg=1
PosEnd=InstrB(PosBeg,RequestBin,getByteString(chr(13)))
boundary=MidB(RequestBin,PosBeg,PosEnd-PosBeg)
boundaryPos=InstrB(1,RequestBin,boundary)
Getalldatainsidetheboundaries
Dountil(boundaryPos=InstrB(RequestBin,boundary&getByteString("--")))
Membersvariableofobjectsareputinadictionaryobject
DimUploadControl
SetUploadControl=CreateObject("Scripting.Dictionary")
Getanobjectname
Pos=InstrB(BoundaryPos,RequestBin,getByteString("Content-Disposition"))
Pos=InstrB(Pos,RequestBin,getByteString("name="))
PosBeg=Pos+6
PosEnd=InstrB(PosBeg,RequestBin,getByteString(chr(34)))
Name=getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
PosFile=InstrB(BoundaryPos,RequestBin,getByteString("filename="))
PosBound=InstrB(PosEnd,RequestBin,boundary)
Testifobjectisoffiletype
IfPosFile0AND(PosFile<PosBound)Then
GetFilename,content-typeandcontentoffile
PosBeg=PosFile+10
PosEnd=InstrB(PosBeg,RequestBin,getByteString(chr(34)))
FileName=getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
FileName=Mid(FileName,InStrRev(FileName,"")+1)
Addfilenametodictionaryobject
UploadControl.Add"FileName",FileName
Pos=InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))
PosBeg=Pos+14
PosEnd=InstrB(PosBeg,RequestBin,getByteString(chr(13)))
Addcontent-typetodictionaryobject
ContentType=getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
UploadControl.Add"ContentType",ContentType
Getcontentofobject
PosBeg=PosEnd+4
PosEnd=InstrB(PosBeg,RequestBin,boundary)-2
Value=FileName
ValueBeg=PosBeg-1
ValueLen=PosEnd-Posbeg
Else
Getcontentofobject
Pos=InstrB(Pos,RequestBin,getByteString(chr(13)))
PosBeg=Pos+4
PosEnd=InstrB(PosBeg,RequestBin,boundary)-2
Value=getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
ValueBeg=0
ValueEnd=0
EndIf
UploadControl.Add"Value",Value
UploadControl.Add"ValueBeg",ValueBeg
UploadControl.Add"ValueLen",ValueLen
UploadRequest.Addname,UploadControl
BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary)
Loop
EndSub
====================================
FunctiongetByteString(StringStr)
====================================
Fori=1toLen(StringStr)
char=Mid(StringStr,i,1)
getByteString=getByteString&chrB(AscB(char))
Next
EndFunction
====================================
FunctiongetString(StringBin)
====================================
getString=""
ForintCount=1toLenB(StringBin)
getString=getString&chr(AscB(MidB(StringBin,intCount,1)))
Next
EndFunction
%>
ASP一般认为只能运行在IIS上,正如前面所提到的,这并不是十分正确,事实上,ASP也能运行在Apache上。ApacheASP可在任意Apache服务器上运行有限的ASP功能,所需做的,只需打开mod_perl。 |
|