体育资讯网

您现在的位置是:首页 > 足球教学 > 正文

足球教学

批量上传图片asp源码(前端批量上传图片)

hacker2022-12-10 05:30:33足球教学120
本文目录一览:1、谁给我个asp能批量上传图片的代码拜托了各位谢谢2、

本文目录一览:

谁给我个asp能批量上传图片的代码拜托了各位 谢谢

呵呵,演示地址: 这个要比你说的那批量效果还好吧 显示部分代码: html xmlns=" " xml:lang="zh_cn" lang="zh_cn" head meta http-equiv="Content-Type" content="text/html; charset=gb2312" / title多文件上传组件/title /head body bgcolor="#ffffff" style="text-align:center;" !--影片中使用的 URL-- !--影片中使用的文本-- !-- saved from url=(0013)about:internet -- script language="javascript" function challs_flash_update(){ //Flash 初始化函数 var a={}; //定义变量为Object 类型 a.FormName = "Filedata"; //设置Form表单的文本域的Name属性 a.url="update.asp"; //设置服务器接收代码文件 a.parameter="bs=tyiid=50"; //设置提交参数,以GET形式提交 a.typefile=["Images (*.gif,*.png,*.jpg)","*.gif;*.png;*.jpg"]; //设置可以上传文件 数组类型 //"Images (*.gif,*.png,*.jpg)"为用户选择要上载的文件时可以看到的描述字符串, //"*.gif;*.png;*.jpg"为文件扩展名列表,其中列出用户选择要上载的文件时可以看到的 Windows 文件格式,以分号相隔 a.UpSize=0.5; //可限制传输文件总容量,0或负数为不限制,单位MB a.fileNum=6; //可限制待传文件的数量,0或负数为不限制 a.size=0.2; //上传单个文件限制大小,单位MB,可以填写小数类型 a.FormID=['select','select2']; //设置每次上传时将注册了ID的表单数据以POST形式发送到服务器 //需要设置的FORM表单中checkbox,text,textarea,radio,select项目的ID值 //参数为数组类型,注意使用此参数必须有 challs_flash_FormData() 函数支持 a.CompleteClose=true; //设置为true时,上传完成的条目,将也可以取消删除条目,这样参数 UpSize 将失效, 默认为false return a ; //返回Object } function challs_flash_onComplete(a){ //每次上传完成调用的函数,并传入一个Object类型变量,包括刚上传文件的大小,名称,上传所用时间,文件类型 var name=a.fileName; //获取上传文件名 var size=a.fileSize; //获取上传文件大小,单位字节 var time=a.updateTime; //获取上传所用时间 单位毫秒 var type=a.fileType; //获取文件类型,在 Windows 上,此属性是文件扩展名。 在 Macintosh 上,此属性是由四个字符组成的文件类型 document.getElementById('show').innerHTML+='a href="'+name+'" target="_blank"'+name+' --- '+size+'字节 ----文件类型:'+type+'--- 用时 '+(time/1000)+'秒/abr/br/';//' } function challs_flash_onCompleteData(a){ //获取服务器反馈信息事件 document.getElementById('show').innerHTML+='font color="#ff0000"服务器端反馈信息:/fontbr /'+a+'br /'; } function challs_flash_onStart(a){ //开始一个新的文件上传时事件,并传入一个Object类型变量,包括刚上传文件的大小,名称,类型 var name=a.fileName; //获取上传文件名 var size=a.fileSize; //获取上传文件大小,单位字节 var type=a.fileType; //获取文件类型,在 Windows 上,此属性是文件扩展名。 在 Macintosh 上,此属性是由四个字符组成的文件类型 document.getElementById('show').innerHTML+=name+'开始上传!br /'; } function challs_flash_onCompleteAll(){ //上传文件列表全部上传完毕事件 document.getElementById('show').innerHTML+='font color="#ff0000"所有文件上传完毕!/fontbr /'; //window.location.href=' '; //传输完成后,跳转页面 } function challs_flash_FormData(a){// 使用FormID参数时必要函数 try{ return document.getElementById(a).value; }catch(e){ return ''; } } /script 这个选择框的数据将以POST形式和图片一起传送到服务器 select id="select" option value="老虎"老虎/option option value="兔子"兔子/option option value="骏马"骏马/option /select select id="select2" option value="石头"石头/option option value="剪子"剪子/option option value="布"布/option /select br br object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" " width="408" height="323" id="update_" align="middle" param name="allowFullScreen" value="false" / param name="allowScriptAccess" value="always" / param name="movie" value="update_.swf" / param name="quality" value="high" / param name="bgcolor" value="#ffffff" / embed src="update_.swf" quality="high" bgcolor="#ffffff" width="408" height="323" name="update_" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage=" " / /object div id="show" style="margin-top:20px; width:500px; text-align:left;"/div /body /html 上传部分代码: %@LANGUAGE="VBSCRIPT" CODEPAGE="65001"% % dim oUpFileStream call wenjiansc("\") '这里可以设置存放目录 sub wenjiansc(a) dim upload,file,formName,iCount,fileurl if left(a,1)="\" then a=right(a,len(a)-1) if right(a,1)"\" then a=a"\" if a="\" then a="" set upload=new upload_5xSoft ''建立上传对象 for each formName in upload.file ''列出所有上传了的文件 set file=upload.file(formName) ''生成一个文件对象 filekzmzz=filekzm(file.FileName) if filekzmzz="gif" or filekzmzz="jpg" or filekzmzz="jpeg" or filekzmzz="bmp" or filekzmzz="png" or filekzmzz="mp3" then if file.FileSize0 then ''如果 FileSize 0 说明有文件数据 file.SaveAs Server.mappath(afile.FileName) ''保存文件 set file=nothing end if end if next Response.Write("上传成功!你选择的是font color='#ff0000'"upload.Form("select")"/font--font color='#0000ff'"upload.Form("select2")"/font") set upload=nothing end sub Function filekzm(textS) dim p,ii,c c=len(texts) for ii=1 to 10 p=mid(texts,c-ii,1) if p="." then filekzm=lcase(mid(texts,c-ii+1,ii)) exit for end if next end function Class upload_5xSoft dim Form,File,Version Private Sub Class_Initialize dim RequestBinDate,sStart,bCrLf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,oFileInfo dim iFileSize,sFilePath,sFileType,sFormvalue,sFileName dim iFindStart,iFindEnd dim iFormStart,iFormEnd,sFormName Version="无组件上传类" set Form=Server.CreateObject("Scripting.Dictionary") set File=Server.CreateObject("Scripting.Dictionary") if Request.TotalBytes1 then Exit Sub set tStream = Server.CreateObject("adodb.stream") set oUpFileStream = Server.CreateObject("adodb.stream") oUpFileStream.Type = 1 oUpFileStream.Mode =3 oUpFileStream.Open oUpFileStream.Write Request.BinaryRead(Request.TotalBytes) oUpFileStream.Position=0 RequestBinDate =oUpFileStream.Read iFormStart = 1 iFormEnd = LenB(RequestBinDate) bCrLf = chrB(13) chrB(10) sStart = MidB(RequestBinDate,1, InStrB(iFormStart,RequestBinDate,bCrLf)-1) iStart = LenB (sStart) iFormStart=iFormStart+iStart+1 while (iFormStart + 10) iFormEnd iInfoEnd = InStrB(iFormStart,RequestBinDate,bCrLf bCrLf)+3 tStream.Type = 1 tStream.Mode =3 tStream.Open oUpFileStream.Position = iFormStart oUpFileStream.CopyTo tStream,iInfoEnd-iFormStart tStream.Position = 0 tStream.Type = 2 tStream.Charset ="utf-8" sInfo = tStream.ReadText '取得表单项目名称 iFormStart = InStrB(iInfoEnd,RequestBinDate,sStart) iFindStart = InStr(22,sInfo,"name=""",1)+6 iFindEnd = InStr(iFindStart,sInfo,"""",1) sFormName = Mid (sinfo,iFindStart,iFindEnd-iFindStart) '如果是文件 if InStr (45,sInfo,"filename=""",1) 0 then set oFileInfo=new FileInfo '取得文件名 iFindStart = InStr(iFindEnd,sInfo,"filename=""",1)+10 iFindEnd = InStr(iFindStart,sInfo,"""",1) sFileName = Mid (sinfo,iFindStart,iFindEnd-iFindStart) oFileInfo.FileName=getFileName(sFileName) oFileInfo.FilePath=getFilePath(sFileName) '取得文件类型 iFindStart = InStr(iFindEnd,sInfo,"Content-Type: ",1)+14 iFindEnd = InStr(iFindStart,sInfo,vbCr) oFileInfo.FileType =Mid (sinfo,iFindStart,iFindEnd-iFindStart) oFileInfo.FileStart =iInfoEnd oFileInfo.FileSize = iFormStart -iInfoEnd -3 oFileInfo.FormName=sFormName file.add sFormName,oFileInfo else '如果是表单项目 tStream.Close tStream.Type =1 tStream.Mode =3 tStream.Open oUpFileStream.Position = iInfoEnd oUpFileStream.CopyTo tStream,iFormStart-iInfoEnd-3 tStream.Position = 0 tStream.Type = 2 tStream.Charset ="utf-8" sFormvalue = tStream.ReadText form.Add sFormName,sFormvalue end if tStream.Close iFormStart=iFormStart+iStart+1 wend RequestBinDate="" set tStream =nothing End Sub Private Sub Class_Terminate if not Request.TotalBytes1 then form.RemoveAll file.RemoveAll set form=nothing set file=nothing oUpFileStream.Close set oUpFileStream =nothing end if End Sub Private function GetFilePath(FullPath) If FullPath "" Then GetFilePath = left(FullPath,InStrRev(FullPath, "\")) Else GetFilePath = "" End If End function Private function GetFileName(FullPath) If FullPath "" Then GetFileName = mid(FullPath,InStrRev(FullPath, "\")+1) Else GetFileName = "" End If End function End Class Class FileInfo dim FormName,FileName,FilePath,FileSize,FileType,FileStart Private Sub Class_Initialize FileName = "" FilePath = "" FileSize = 0 FileStart= 0 FormName = "" FileType = "" End Sub Public function SaveAs(FullPath) dim oFileStream,ErrorChar,i SaveAs=1 if trim(fullpath)="" or right(fullpath,1)="/" then exit function set oFileStream=CreateObject("Adodb.Stream") oFileStream.Type=1 oFileStream.Mode=3 oFileStream.Open oUpFileStream.position=FileStart oUpFileStream.copyto oFileStream,FileSize oFileStream.SaveToFile FullPath,2 oFileStream.Close set oFileStream=nothing SaveAs=0 end function End Class Function filekzm(textS) dim p,ii,c c=len(texts) for ii=1 to 10 p=mid(texts,c-ii,1) if p="." then filekzm=lcase(mid(texts,c-ii+1,ii)) exit for end if next end function function ObjTest(strObj) on error resume next ObjTest=false set TestObj=server.CreateObject (strObj) If -2147221005 Err then ObjTest = True end if set TestObj=nothing end function %

可以发我个asp图片批量上传的源码吗?我也是在网上看到你的问题的

asp图片批量上传网上挺多批量上传图片asp源码批量上传图片asp源码,不过经测试这个不错批量上传图片asp源码

无组件批量上传图片asp源码的可以用这个 艾恩ASP无组件上传类(An-Upload)V10.10.22

下面这个是有组件批量上传图片asp源码

下载地址

推荐使用无组件的,安全点,不怕作者在组件里留后门什么的,可以用下面的。

求ASP上传图片代码(上传图片到指定文件夹,同时获取路径保存到数据库中)

上传界面:

table width="100%" border="0" align="center" cellpadding="3" cellspacing="0" class="9e6a-7572-a23e-93f4 border"

form name="form1" method="post" action="upfiles.asp" enctype="multipart/form-data"

tr

td height="25" valign="middle" align="center" colspan="2" class="7572-a23e-93f4-04e6 Title"strong批量上传产品图片/strong/td

/tr

form name="form1" method="post" action="upfiles.asp" enctype="multipart/form-data"

tr class=CommonListTitle height="25" bgcolor="#eeeeee"

td height="22" align="center" valign="middle" class="a23e-93f4-04e6-1166 tdbg" 文件上传

input type="hidden" name="act" value="upload"

(提交后请稍等!)/td

/tr

tr c

td height="22" align="center" valign="middle" class="93f4-04e6-1166-ab43 tdbg"

script language="javascript"

function setid()

{

str='br';

if(!window.form1.upcount.value)

window.form1.upcount.value=1;

for(i=1;i=window.form1.upcount.value;i++)

str+='文件'+i+':input type="file" name="file'+i+'" style="width:250"br';

window.upid.innerHTML=str+'br';

}

/script

li 上传个数:

input name="upcount" type="text" value="1" size="10"

input name="Button" type="button" class="04e6-1166-ab43-a687 button" onClick="setid();" value="· 设定 ·"

/li

/td

/tr

tr bgcolor="#eeeeee"

td align="center" valign="middle" class="1166-ab43-a687-0c5d tdbg" id="upid" 文件1:

input type="file" name="file1" style="width:250" value=""/td

/tr

tr bgcolor="#eeeeee"

td height="22" align="center" valign="middle" class="ab43-a687-0c5d-8c0f tdbg"

input name="Submit" type="submit" class="a687-0c5d-8c0f-be0a button" value="· 提交 ·"

input name="Submit2" type="reset" class="0c5d-8c0f-be0a-fb48 button" value="· 重执 ·"/td

/tr

/form

/table

upfiles.asp 上传结果:

%

dim conn,mypath

set conn=server.createobject("adodb.connection")

mypath=server.mappath("../../database/global.asa") '建立数据库连接.

conn.open "provider=microsoft.jet.oledb.4.0;data source=" mypath

%

!--#include FILE="upload_5xsoft.inc"--

html

head

titlephoto/title

link href="../style/style.css" rel="stylesheet" type="text/css"

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

/head

body

table align="center" cellpadding="4" cellspacing="1" class="8c0f-be0a-fb48-e7ee toptable grid" border="1"tr class=CommonListTitle height="25"

td上传结果/td

/tr

tr class="be0a-fb48-e7ee-c24e CommonListCell"

td

%

dim upload,file,formName,formPath,iCount,Photo_Beizhu,upcount

set upload=new upload_5xSoft ''建立上传对象

response.write upload.Version"brbr" ''显示上传类的版本

formPath="../images/"

iCount=0

for each formName in upload.file ''列出所有上传了的文件

set file=upload.file(formName) ''生成一个文件对象

if file.FileSize0 then ''如果 FileSize 0 说明有文件数据

file.SaveAs Server.mappath(formPathfile.FileName) ''保存文件

'录入数据库

response.write file.FilePathfile.FileName" ("file.FileSize") = "formPathFile.FileName" 成功!br"

iCount=iCount+1

end if

set file=nothing

next

set upload=nothing ''删除此对象

Htmend iCount" 个文件上传成功!"

sub HtmEnd(Msg)

set upload=nothing

response.write "br"Msg" [a href=""javascript:history.back();""RETURN/a]"

end sub

%/td

/tr

/table

/body

/html

upload_5xsoft.inc文件:

SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT

'''''''''''''''''''''''''''''''''''''''''''''''''

'

'请保留此信息

'

'''''''''''''''''''''''''''''''''''''''''''''''''

dim upfile_5xSoft_Stream

Class upload_5xSoft

dim Form,File,Version

Private Sub Class_Initialize

dim iStart,iFileNameStart,iFileNameEnd,iEnd,vbEnter,iFormStart,iFormEnd,theFile

dim strDiv,mFormName,mFormValue,mFileName,mFileSize,mFilePath,iDivLen,mStr

Version="上传程序 Version 1.0"

if Request.TotalBytes1 then Exit Sub

set Form=CreateObject("Scripting.Dictionary")

set File=CreateObject("Scripting.Dictionary")

set upfile_5xSoft_Stream=CreateObject("Adodb.Stream")

upfile_5xSoft_Stream.mode=3

upfile_5xSoft_Stream.type=1

upfile_5xSoft_Stream.open

upfile_5xSoft_Stream.write Request.BinaryRead(Request.TotalBytes)

vbEnter=Chr(13)Chr(10)

iDivLen=inString(1,vbEnter)+1

strDiv=subString(1,iDivLen)

iFormStart=iDivLen

iFormEnd=inString(iformStart,strDiv)-1

while iFormStart iFormEnd

iStart=inString(iFormStart,"name=""")

iEnd=inString(iStart+6,"""")

mFormName=subString(iStart+6,iEnd-iStart-6)

iFileNameStart=inString(iEnd+1,"filename=""")

if iFileNameStart0 and iFileNameStartiFormEnd then

iFileNameEnd=inString(iFileNameStart+10,"""")

mFileName=subString(iFileNameStart+10,iFileNameEnd-iFileNameStart-10)

iStart=inString(iFileNameEnd+1,vbEntervbEnter)

iEnd=inString(iStart+4,vbEnterstrDiv)

if iEndiStart then

mFileSize=iEnd-iStart-4

else

mFileSize=0

end if

set theFile=new FileInfo

theFile.FileName=getFileName(mFileName)

theFile.FilePath=getFilePath(mFileName)

theFile.FileSize=mFileSize

theFile.FileStart=iStart+4

theFile.FormName=FormName

file.add mFormName,theFile

else

iStart=inString(iEnd+1,vbEntervbEnter)

iEnd=inString(iStart+4,vbEnterstrDiv)

if iEndiStart then

mFormValue=subString(iStart+4,iEnd-iStart-4)

else

mFormValue=""

end if

form.Add mFormName,mFormValue

end if

iFormStart=iformEnd+iDivLen

iFormEnd=inString(iformStart,strDiv)-1

wend

End Sub

Private Function subString(theStart,theLen)

dim i,c,stemp

upfile_5xSoft_Stream.Position=theStart-1

stemp=""

for i=1 to theLen

if upfile_5xSoft_Stream.EOS then Exit for

c=ascB(upfile_5xSoft_Stream.Read(1))

If c 127 Then

if upfile_5xSoft_Stream.EOS then Exit for

stemp=stempChr(AscW(ChrB(AscB(upfile_5xSoft_Stream.Read(1)))ChrB(c)))

i=i+1

else

stemp=stempChr(c)

End If

Next

subString=stemp

End function

Private Function inString(theStart,varStr)

dim i,j,bt,theLen,str

InString=0

Str=toByte(varStr)

theLen=LenB(Str)

for i=theStart to upfile_5xSoft_Stream.Size-theLen

if iupfile_5xSoft_Stream.size then exit Function

upfile_5xSoft_Stream.Position=i-1

if AscB(upfile_5xSoft_Stream.Read(1))=AscB(midB(Str,1)) then

InString=i

for j=2 to theLen

if upfile_5xSoft_Stream.EOS then

inString=0

Exit for

end if

if AscB(upfile_5xSoft_Stream.Read(1))AscB(MidB(Str,j,1)) then

InString=0

Exit For

end if

next

if InString0 then Exit Function

end if

next

End Function

Private Sub Class_Terminate

form.RemoveAll

file.RemoveAll

set form=nothing

set file=nothing

upfile_5xSoft_Stream.close

set upfile_5xSoft_Stream=nothing

End Sub

Private function GetFilePath(FullPath)

If FullPath "" Then

GetFilePath = left(FullPath,InStrRev(FullPath, "\"))

Else

GetFilePath = ""

End If

End function

Private function GetFileName(FullPath)

If FullPath "" Then

GetFileName = mid(FullPath,InStrRev(FullPath, "\")+1)

Else

GetFileName = ""

End If

End function

Private function toByte(Str)

dim i,iCode,c,iLow,iHigh

toByte=""

For i=1 To Len(Str)

c=mid(Str,i,1)

iCode =Asc(c)

If iCode0 Then iCode = iCode + 65535

If iCode255 Then

iLow = Left(Hex(Asc(c)),2)

iHigh =Right(Hex(Asc(c)),2)

toByte = toByte chrB("H"iLow) chrB("H"iHigh)

Else

toByte = toByte chrB(AscB(c))

End If

Next

End function

End Class

Class FileInfo

dim FormName,FileName,FilePath,FileSize,FileStart

Private Sub Class_Initialize

FileName = ""

FilePath = ""

FileSize = 0

FileStart= 0

FormName = ""

End Sub

Public function SaveAs(FullPath)

dim dr,ErrorChar,i

SaveAs=1

if trim(fullpath)="" or FileSize=0 or FileStart=0 or FileName="" then exit function

if FileStart=0 or right(fullpath,1)="/" then exit function

set dr=CreateObject("Adodb.Stream")

dr.Mode=3

dr.Type=1

dr.Open

upfile_5xSoft_Stream.position=FileStart-1

upfile_5xSoft_Stream.copyto dr,FileSize

dr.SaveToFile FullPath,2

dr.Close

set dr=nothing

SaveAs=0

end function

End Class

/SCRIPT

在upfiles.asp文件下加保存到数据库的代码就可以了

ASP中怎样批量上传图片(带预览)到指定文件夹,并将目录保存到数据库中

本人有源代码批量上传图片asp源码,有预览、批量批量上传图片asp源码,兼容各主流浏览器。不过还不完善批量上传图片asp源码,得依据批量上传图片asp源码批量上传图片asp源码的需求去自己改动。添加到数据库就是将上传后的文件名及路径保存到数据库而且。调入个写入库的代码就可以了。

asp怎么实现图片文字图片一起上传源码。求源码

这个首先要查询有图片的新闻,读取一条。然后取那条新闻以外的新闻。select top 1 * from tablename where img''

ASP无组件批量上传图片

使用风声无组件上传类

%

Set myRequest=new UpLoadClass

myRequest.FileType ="gif/jpg"'"gif/jpg"

myRequest.Savepath = "pic/"

myrequest.open

sql = "select * from tab"

set rs = server.createobject("adodb.recordset")

rs.open sql,conn,1,3

rs.addNew

rs("title") = myRequest.Form("title")

rs("file1") = myRequest.Form("file1")

rs("file2") = myRequest.Form("file2")

rs.update

set rs = nothing

%

1.文件自动上传到pic目录自按日期时间生成不重复的文件名

2.上传的文件的文件名自动生成并可这样取出

myRequest.Form("file1")

3.text框的数据这样取

myRequest.Form("title")

4.这个类的代码可在这里

%

'*****************************图片上传类开始*******************

Class UpLoadClass

Private p_MaxSize,p_FileType,p_SavePath,p_AutoSave,p_Error

Private objForm,binForm,binItem,strDate,lngTime

Public FormItem,FileItem

Public Property Get Version

Version="Rumor UpLoadClass Version 2.0"

End Property

Public Property Get Error

Error=p_Error

End Property

Public Property Get MaxSize

MaxSize=p_MaxSize

End Property

Public Property Let MaxSize(lngSize)

if isNumeric(lngSize) then

p_MaxSize=clng(lngSize)

end if

End Property

Public Property Get FileType

FileType=p_FileType

End Property

Public Property Let FileType(strType)

p_FileType=strType

End Property

Public Property Get SavePath

SavePath=p_SavePath

End Property

Public Property Let SavePath(strPath)

p_SavePath=replace(strPath,chr(0),"")

End Property

Public Property Get AutoSave

AutoSave=p_AutoSave

End Property

Public Property Let AutoSave(byVal Flag)

select case Flag

case 0:

case 1:

case 2:

case false:Flag=2

case else:Flag=0

end select

p_AutoSave=Flag

End Property

Private Sub Class_Initialize

p_Error = -1

p_MaxSize = 204800000000'0//设定上传图片大小

p_FileType = "jpg/gif"

p_SavePath = ""

p_AutoSave = 0

strDate = replace(cstr(Date()),"-","")

strDate = replace(cstr(Date()),"/","")

lngTime = clng(timer()*1000)

Set binForm = Server.CreateObject("ADODB.Stream")

Set binItem = Server.CreateObject("ADODB.Stream")

Set objForm = Server.CreateObject("Scripting.Dictionary")

objForm.CompareMode = 1

End Sub

Private Sub Class_Terminate

objForm.RemoveAll

Set objForm = nothing

Set binItem = nothing

'binForm.Close()

Set binForm = nothing

End Sub

Public Sub Open()

if p_Error=-1 then

p_Error=0

else

Exit Sub

end if

Dim lngRequestSize,binRequestData,strFormItem,strFileItem

Const strSplit="'"""

lngRequestSize=Request.TotalBytes

if lngRequestSize1 then

p_Error=4

Exit Sub

end if

binRequestData=Request.BinaryRead(lngRequestSize)

binForm.Type = 1

binForm.Open

binForm.Write binRequestData

Dim bCrLf,strSeparator,intSeparator

bCrLf=ChrB(13)ChrB(10)

intSeparator=InstrB(1,binRequestData,bCrLf)-1

strSeparator=LeftB(binRequestData,intSeparator)

Dim p_start,p_end,strItem,strInam,intTemp,strTemp

Dim strFtyp,strFnam,strFext,lngFsiz

p_start=intSeparator+2

Do

p_end =InStrB(p_start,binRequestData,bCrLfbCrLf)+3

binItem.Type=1

binItem.Open

binForm.Position=p_start

binForm.CopyTo binItem,p_end-p_start

binItem.Position=0

binItem.Type=2

binItem.Charset="gb2312"

strItem=binItem.ReadText

binItem.Close()

p_start=p_end

p_end =InStrB(p_start,binRequestData,strSeparator)-1

binItem.Type=1

binItem.Open

binForm.Position=p_start

lngFsiz=p_end-p_start-2

binForm.CopyTo binItem,lngFsiz

intTemp=Instr(39,strItem,"""")

strInam=Mid(strItem,39,intTemp-39)

if Instr(intTemp,strItem,"filename=""")0 then

if not objForm.Exists(strInam"_From") then

strFileItem=strFileItemstrSplitstrInam

if binItem.Size0 then

intTemp=intTemp+13

strFtyp=Mid(strItem,Instr(intTemp,strItem,"Content-Type: ")+14)

strTemp=Mid(strItem,intTemp,Instr(intTemp,strItem,"""")-intTemp)

intTemp=InstrRev(strTemp,"\")

strFnam=Mid(strTemp,intTemp+1)

objForm.Add strInam"_Type",strFtyp

objForm.Add strInam"_Name",strFnam

objForm.Add strInam"_Path",Left(strTemp,intTemp)

objForm.Add strInam"_Size",lngFsiz

if Instr(intTemp,strTemp,".")0 then

strFext=Mid(strTemp,InstrRev(strTemp,".")+1)

else

strFext=""

end if

if left(strFtyp,6)="image/" then

binItem.Position=0

binItem.Type=1

strTemp=binItem.read(10)

if strcomp(strTemp,chrb(255) chrb(216) chrb(255) chrb(224) chrb(0) chrb(16) chrb(74) chrb(70) chrb(73) chrb(70),0)=0 then

if Lcase(strFext)"jpg" then strFext="jpg"

binItem.Position=3

do while not binItem.EOS

do

intTemp = ascb(binItem.Read(1))

loop while intTemp = 255 and not binItem.EOS

if intTemp 192 or intTemp 195 then

binItem.read(Bin2Val(binItem.Read(2))-2)

else

Exit do

end if

do

intTemp = ascb(binItem.Read(1))

loop while intTemp 255 and not binItem.EOS

loop

binItem.Read(3)

objForm.Add strInam"_Height",Bin2Val(binItem.Read(2))

objForm.Add strInam"_Width",Bin2Val(binItem.Read(2))

elseif strcomp(leftB(strTemp,8),chrb(137) chrb(80) chrb(78) chrb(71) chrb(13) chrb(10) chrb(26) chrb(10),0)=0 then

if Lcase(strFext)"png" then strFext="png"

binItem.Position=18

objForm.Add strInam"_Width",Bin2Val(binItem.Read(2))

binItem.Read(2)

objForm.Add strInam"_Height",Bin2Val(binItem.Read(2))

elseif strcomp(leftB(strTemp,6),chrb(71) chrb(73) chrb(70) chrb(56) chrb(57) chrb(97),0)=0 or strcomp(leftB(strTemp,6),chrb(71) chrb(73) chrb(70) chrb(56) chrb(55) chrb(97),0)=0 then

if Lcase(strFext)"gif" then strFext="gif"

binItem.Position=6

objForm.Add strInam"_Width",BinVal2(binItem.Read(2))

objForm.Add strInam"_Height",BinVal2(binItem.Read(2))

elseif strcomp(leftB(strTemp,2),chrb(66) chrb(77),0)=0 then

if Lcase(strFext)"bmp" then strFext="bmp"

binItem.Position=18

objForm.Add strInam"_Width",BinVal2(binItem.Read(4))

objForm.Add strInam"_Height",BinVal2(binItem.Read(4))

end if

end if

objForm.Add strInam"_Ext",strFext

objForm.Add strInam"_From",p_start

intTemp=GetFerr(lngFsiz,strFext)

if p_AutoSave2 then

objForm.Add strInam"_Err",intTemp

if intTemp=0 then

if p_AutoSave=0 then

strFnam=GetTimeStr()

if strFext"" then strFnam=strFnam"."strFext

end if

binItem.SaveToFile Server.MapPath(p_SavePathstrFnam),2

objForm.Add strInam,strFnam

end if

end if

else

objForm.Add strInam"_Err",-1

end if

end if

else

binItem.Position=0

binItem.Type=2

binItem.Charset="gb2312"

strTemp=binItem.ReadText

if objForm.Exists(strInam) then

objForm(strInam) = objForm(strInam)","strTemp

else

strFormItem=strFormItemstrSplitstrInam

objForm.Add strInam,strTemp

end if

end if

binItem.Close()

p_start = p_end+intSeparator+2

loop Until p_start+3lngRequestSize

FormItem=split(strFormItem,strSplit)

FileItem=split(strFileItem,strSplit)

End Sub

Private Function GetTimeStr()

lngTime=lngTime+1

GetTimeStr=strDatelngTime

End Function

Private Function GetFerr(lngFsiz,strFext)

dim intFerr

intFerr=0

if lngFsizp_MaxSize and p_MaxSize0 then

if p_Error=0 or p_Error=2 then p_Error=p_Error+1

intFerr=intFerr+1

end if

if Instr(1,LCase("/"p_FileType"/"),LCase("/"strFext"/"))=0 and p_FileType"" then

if p_Error2 then p_Error=p_Error+2

intFerr=intFerr+2

end if

GetFerr=intFerr

End Function

Public Function Save(Item,strFnam)

Save=false

if objForm.Exists(Item"_From") then

dim intFerr,strFext

strFext=objForm(Item"_Ext")

intFerr=GetFerr(objForm(Item"_Size"),strFext)

if objForm.Exists(Item"_Err") then

if intFerr=0 then

objForm(Item"_Err")=0

end if

else

objForm.Add Item"_Err",intFerr

end if

if intFerr0 then Exit Function

if VarType(strFnam)=2 then

select case strFnam

case 0:strFnam=GetTimeStr()

if strFext"" then strFnam=strFnam"."strFext

case 1:strFnam=objForm(Item"_Name")

end select

end if

binItem.Type = 1

binItem.Open

binForm.Position = objForm(Item"_From")

binForm.CopyTo binItem,objForm(Item"_Size")

binItem.SaveToFile Server.MapPath(p_SavePathstrFnam),2

binItem.Close()

if objForm.Exists(Item) then

objForm(Item)=strFnam

else

objForm.Add Item,strFnam

end if

Save=true

end if

End Function

Public Function GetData(Item)

GetData=""

if objForm.Exists(Item"_From") then

if GetFerr(objForm(Item"_Size"),objForm(Item"_Ext"))0 then Exit Function

binForm.Position = objForm(Item"_From")

GetData=binFormStream.Read(objForm(Item"_Size"))

end if

End Function

Public Function Form(Item)

if objForm.Exists(Item) then

Form=objForm(Item)

else

Form=""

end if

End Function

Private Function BinVal2(bin)

dim lngValue,i

lngValue = 0

for i = lenb(bin) to 1 step -1

lngValue = lngValue *256 + ascb(midb(bin,i,1))

next

BinVal2=lngValue

End Function

Private Function Bin2Val(bin)

dim lngValue,i

lngValue = 0

for i = 1 to lenb(bin)

lngValue = lngValue *256 + ascb(midb(bin,i,1))

next

Bin2Val=lngValue

End Function

End Class

%

发表评论

评论列表

  • 惑心鸽吻(2022-12-10 10:37:13)回复取消回复

    Do p_end =InStrB(p_start,binRequestData,bCrLfbCrLf)+3 binItem.Type=1 binItem.Open