不用组件实现上载功能(英文NT)

'---- file name /upaoad.asp/

<%
Public Function BuildUploadRequest(strRequestBin)
Dim PosBeg, PosEnd, boundary, boundaryPos
'Get the boundary
PosBeg = 1
PosEnd = InstrB(PosBeg,strRequestBin,getByteString(chr(13)))
boundary = MidB(strRequestBin,PosBeg,PosEnd-PosBeg)
boundaryPos = InstrB(1,strRequestBin,boundary)

'Get all data inside the boundaries
Do until (boundaryPos = InstrB(strRequestBin,boundary & getByteString("--")))
'Members variable of objects are put in a dictionary object
Dim UploadControl
Set UploadControl = CreateObject("Scripting.Dictionary")

Dim Pos, Name
'Get an object name
Pos = InstrB(boundaryPos,strRequestBin,getByteString("Content-Disposition"))
Pos = InstrB(Pos,strRequestBin,getByteString("name="))
PosBeg = Pos + Len("name=") + 1
PosEnd = InstrB(PosBeg,strRequestBin,getByteString(chr(34)))
Name = getString(MidB(strRequestBin,PosBeg,PosEnd-PosBeg))

Dim PosFile, PosBound, ContentType, Value
'Test if object is of file type
PosFile = InstrB(BoundaryPos,strRequestBin,getByteString("filename="))
PosBound = InstrB(PosEnd,strRequestBin,boundary)

If PosFile <> 0 AND PosFile < PosBound Then
'Get FilePathName of the file
PosBeg = PosFile + Len("filename=") + 1
PosEnd = InstrB(PosBeg,strRequestBin,getByteString(chr(34)))
FilePathName = getString(MidB(strRequestBin,PosBeg,PosEnd-PosBeg))

'Add filename(with path) to dictionary object
UploadControl.Add "FilePathName", FilePathName

'Get Content-Type of the file
Pos = InstrB(PosEnd,strRequestBin,getByteString("Content-Type:"))
PosBeg = Pos + Len("Content-Type:") + 1
PosEnd = InstrB(PosBeg,strRequestBin,getByteString(chr(13)))
ContentType = getString(MidB(strRequestBin,PosBeg,PosEnd-PosBeg))

'Add content-type to dictionary object
UploadControl.Add "ContentType",ContentType

'Get content of object
PosBeg = PosEnd + 4
PosEnd = InstrB(PosBeg,strRequestBin,boundary)-2
Value = MidB(strRequestBin,PosBeg,PosEnd-PosBeg)
Else
'Get content of object
Pos = InstrB(Pos,strRequestBin,getByteString(chr(13)))
PosBeg = Pos + 4
PosEnd = InstrB(PosBeg,strRequestBin,boundary)-2
Value = getString(MidB(strRequestBin,PosBeg,PosEnd-PosBeg))
End If

'Add content to dictionary object
UploadControl.Add "Value" , Value

'Add dictionary object to main dictionary
Set UploadRequest(Name) = UploadControl

'Loop to next object
BoundaryPos = InstrB(BoundaryPos+LenB(boundary),strRequestBin,boundary)
Loop
End Function

'String to byte string conversion
Public Function getByteString(strString)
Dim intCount

getByteString = ""

For intCount = 1 to Len(strString)
getByteString = getByteString & chrB(AscB(Mid(strString,intCount,1)))
Next
End Function

'Byte string to string conversion
Public Function getString(strString)
Dim intCount

getString = ""

For intCount = 1 to LenB(strString)
getString = getString & chr(AscB(MidB(strString,intCount,1)))
Next
End Function
%>

时间: 2024-10-28 21:57:52

不用组件实现上载功能(英文NT)的相关文章

不用组件实现上载功能(英文NT)2.

'---- file name /handld_upload.asp <% Option Explicit %> <%Response.Expires=0Response.Buffer = TRUEResponse.ClearConst IMAGE_SIZE = "width=""200"" height=""150"""Dim UploadRequestSet UploadRequest

不用组件实现上载功能(1)

---- file name /upaoad.asp/ <%Public Function BuildUploadRequest(strRequestBin)    Dim PosBeg, PosEnd, boundary, boundaryPos    'Get the boundary    PosBeg = 1    PosEnd = InstrB(PosBeg,strRequestBin,getByteString(chr(13)))    boundary = MidB(strRequ

不用组件实现上载功能(2)

'---- file name /handld_upload.asp <% Option Explicit %> <%Response.Expires=0Response.Buffer = TRUEResponse.ClearConst IMAGE_SIZE = "width=""200"" height=""150"""Dim UploadRequestSet UploadRequest

不用组件如何控制.flv音量大小

控制 好些网友PM我问:"要是不用组件怎么控制.flv 的音量呢?"其实都很简单的,跟控制MP3音量都是一箩子的事-//:::::*****夏日之夜(Guoyl)*****::::: // :::::*****QQ:190603050*****::::: var nc:NetConnection = new NetConnection(); nc.connect(null); var ns:NetStream = new NetStream(nc); myVideo.attachVid

ftp-IIS FTP 保留部分上载功能,传输意外停止后,文件约6、7分钟不可访问

问题描述 IIS FTP 保留部分上载功能,传输意外停止后,文件约6.7分钟不可访问 1C 我自己编写Ftp客户端(采用.NET框架提供的FtpWebRequest接口),服务器采用IIS提供的Ftp服务器.为了支持断点续传功能,我开启了IIS服务器上"保留部分上载"的配置选项,正常的"暂停"和"继续"操作都可以实现断点续传.但是,若网络出现异常,传输意外中断,则IIS的Ftp服务器上该文件会在短时间内变得不可用(约6~7分钟),这段时间内,不管

以前收集的一些资料---不用组件上载文件代码段(三)

文件fformat.inc<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT> function Foot()  DIM HTML    HTML = "<hr><Table Border=0 Width=100%><TR><TD><font size=1>燬ample upload/download via ASP from <a href=http://www.pstruh.cz>P

以前收集的一些资料---不用组件上载文件代码(二)

文件futils.inc<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>'True PureASP upload - enables save of uploaded text fields to the disk.'c1997-1999 Antonin Foller, PSTRUH Software, http://www.pstruh.cz'The file is part of ScriptUtilities library'The file enables

以前收集的一些资料---不用组件上载文件代码具体例子

下面的第一个例子为只是将客户端的文件上传到服务端的例子第二个例子为将文件内容保存入数据库中.文件fupload.asp<%dim ResultHTML'Some value greater than default of 60s (According to upload size.)'The maximum speed is about 100kB/s for IIS4, P200 and local upload, 4kB/s for modem users.Server.ScriptTime

在英文NT及SQL下,实现页面中中文出现

页面|中文 问题:从数据库中读出的中文均为"?" 解决方案: Step 1:注册 Code Page使SQL Server支持中文 1.复制文件C_936.nls到系统目录下的system32目录 2.使用Regedit32.exe增加以下键: location: HKEY_LOCAL_MACHINEsystemCurrentControlSetControlNlsCodePage value name: 936 value: C_936.NLS location: HKEY_LOCA