啤酒标签上要写什么:无组件上传图片和文本域的问题

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/27 21:55:49
无组件上传图片和文本、文本域时,图片和文本都能正常上传,维有文本域只上传了第一段。
<%
'把一段二进制数据写入到一个文件
sub saveBin2File(srmSource,posB,posLen,strPath)
dim srmObj
set srmObj = server.CreateObject("adodb.stream")
srmObj.Type = 1
srmObj.Mode = 3
srmObj.Open
srmSource.Position = posB-1
srmSource.CopyTo srmObj,posLen
srmObj.Position = 0
srmObj.SaveToFile strPath,2'如果该文件已经存在,无条件覆盖
srmObj.Close
set srmObj = nothing
end sub
'二进制数据转换为字符串,包括汉字
function getTextfromBin(srmSource,posBegin,posLen)
dim srmObj, strData
set srmObj = server.CreateObject("adodb.stream")
srmObj.Type = 1
srmObj.Mode = 3
srmObj.Open
srmSource.position = posBegin-1'位置计数首数不一样,这个对象是对0开始的
srmSource.CopyTo srmObj,posLen
srmObj.Position = 0
srmObj.Type = 2
srmObj.Charset = "gb2312"
strData = srmObj.ReadText
srmObj.Close
set srmObj = nothing
getTextfromBin = strData
end function
'双字节字符串转换成单字节字符串
function getSBfromDB(bytString)
dim bin, i
bin = ""
for i=1 to len(bytString)
bin = bin & chrb(asc(mid(bytString,i,2)))
next
getSBfromDB = bin
end function
'单字节字符串转换成双字节字符串
function getDBfromSB(bitString)
dim str, i
str = ""
for i=1 to lenb(bitString)
str = str & chr(ascb(midb(bitString,i,1)))
next
getDBfromSB = str
end function

'从一个完整路径中析出文件名称
function getFileNamefromPath(strPath)
getFileNamefromPath = mid(strPath,instrrev(strPath,"\")+1)
end function
'判断函数
function iif(cond,expr1,expr2)
if cond then
iif = expr1
else
iif = expr2
end if
end function
%>
后面的代码跟这里差不多http://www.webjx.com/htmldata/2006-02-19/1140342705.html

<%
if request.ServerVariables("REQUEST_METHOD") = "POST" then
dim sCome, binData
dim posB, posE, posSB, posSE
dim binCrlf, binSub
dim strProductID, strproductSort, strProductName, strProductNarrate, strProductSpecs, strFileName, strContentType, posFileBegin, posFileLen, aryFileInfo
dim i, j
dim dicData
dim strName,strValue
binCrlf = getSBfromDB(vbcrlf)'定义一个单字节的回车换行符
binSub = getSBfromDB("--")'定义一个单字节的“--”字符串
set sCome = server.CreateObject("adodb.stream")
sCome.Type = 1'指定返回数据类型 adTypeBinary=1,adTypeText=2
sCome.Mode = 3'指定打开模式 adModeRead=1,adModeWrite=2,adModeReadWrite=3
sCome.Open
sCome.Write request.BinaryRead(request.TotalBytes)
sCome.Position = 0