数据库设置:(access)
id photo bigphoto
我在img目录下建立了两个文件夹:product和Product1,photo和bigphoto里面的图片链接地址就指向这两个文件夹。
我想同时上传一张小图片和一张大图片到数据库里面,然后读取出来,效果就是点击小图片,就弹出大图片(尽管我知道用缩略图能做一样的结果,但效果不一样,我这个小图片是经过处理好的,而大图片直接强制指定尺寸的小图,效果完全不一样!)。
希望各位大侠指导!!
6 个解决方案
#1
看来你们一直都没有解决http uncode的问题..
总是想方设法绕过多个field混合提交的可能..
这不问题就来了..
找找前面的贴子,有关于解码http 提交的二进制数据的内容
总是想方设法绕过多个field混合提交的可能..
这不问题就来了..
找找前面的贴子,有关于解码http 提交的二进制数据的内容
#2
请高手指教!!实在不懂!
#3
FILEUPLOAD.ASP
<%
sub GetUpload(FormData)
Dim DivStr,DivLen,PosOpenBoundary,PosCloseBoundary
Dim FieldNameStart,FormFieldName,FieldNameSize,FormFieldData,DataStart,DataEnd,DataSize
Dim FieldFileNameStart,FormFileName,FieldFileNameSize
Dim FieldFileCTStart,FormFileCT,FieldFileCTSize
'分隔标志串(+CRLF),
DivStr=LeftB(FormData,InStrB(FormData,str2bin(VbCrLf))-1)
'分隔标志串长度
DivLen=LenB(DivStr)
PosOpenBoundary=InStrB(FormData,DivStr)
PosCloseBoundary=InStrB(PosOpenBoundary+1,FormData,DivStr)
Do until PosCloseBoundary=lenb(FormData) or PosCloseBoundary=0 '(PosOpenBoundary=lenb(FormData))
dim Field,FirstField,bIsFile
bIsFile=false
FormFieldName=""
Set Field=CreateObject("Scripting.Dictionary")
'Name起始位置(Name="xxxxx"),加6是因为[Name="]长度为6
FieldNameStart=InStrB(PosOpenBoundary,FormData,str2bin("name="))+6
FieldNameSize=InStrB(FieldNameStart,FormData,ChrB(34))-FieldNameStart'(")的ASC值=34
FormFieldName=bin2str(MidB(FormData,FieldNameStart,FieldNameSize))
'FileName起始位置(FileName="xxxxx")
FieldFileNameStart=InStrB(PosOpenBoundary,FormData,str2bin("filename="))+10
if PosCloseBoundary=0 then
PosCloseBoundary=lenb(FormData)
end if
If FieldFileNameStart<PosCloseBoundary And FieldFileNameStart>PosopenBoundary Then
FieldFileNameSize=InStrB(FieldFileNameStart,FormData,ChrB(34))-FieldFileNameStart '(")的ASC值=34
FormFileName=bin2str(MidB(FormData,FieldFileNameStart,FieldFileNameSize))
Field.Add "FilePath",FormFileName
Field.Add "FileName",GetFileName(FormFileName)
bIsFile=true
End If
'Content-Type起始位置(Content-Type: xxxxx)
FieldFileCTStart=InStrB(PosOpenBoundary,FormData,str2bin("Content-Type:"))+14
If FieldFileCTStart<PosCloseBoundary And FieldFileCTStart>PosOpenBoundary Then
FieldFileCTSize=InStrB(FieldFileCTStart,FormData,str2bin(VbCrLf & VbCrLf))-FieldFileCTStart
FormFileCT=bin2str(MidB(FormData,FieldFileCTStart,FieldFileCTSize))
Field.Add "ContentType",FormFileCT
End If
'数据起始位置:2个CRLF开始
If bIsFile Then
DataStart=InStrB(FieldFileCTStart,FormData,str2bin(VbCrLf))+4
DataEnd=InstrB(DataStart,FormData,DivStr)-2
FormFieldData=MidB(FormData,DataStart,DataEnd-DataStart)
Else
DataStart=InstrB(FieldNameStart,FormData,str2bin(VbCrLf))+4
DataEnd=InstrB(DataStart,RequestBin,DivStr)-2
FormFieldData=bin2str(MidB(FormData,DataStart,DataEnd-DataStart))
End If
Field.Add "Value",FormFieldData
Field.Add "FieldDataBgnPos",DataStart
Field.Add "FieldDataLength",DataEnd-DataStart
if UploadRequest.Exists(FormFieldName) then
iCount=UploadRequest(FormFieldName).Count
UploadRequest(FormFieldName).Add iCount,Field
else
Set FirstField=CreateObject("Scripting.Dictionary")
FirstField.Add 0,Field
UploadRequest.Add FormFieldName,FirstField
end if
PosOpenBoundary=PosCloseBoundary
PosCloseBoundary=InStrB(PosOpenBoundary+1,FormData,DivStr)
loop
End sub
'把二进制字符串转换成普通字符串函数
Function bin2str(binstr)
Dim varlen,clow,ccc,skipflag,i
'中文字符Skip标志
skipflag=0
ccc=""
If Not IsNull(binstr) Then
varlen=LenB(binstr)
For i=1 To varlen
If skipflag=0 Then
clow=MidB(binstr,i,1)
'判断是否中文的字符
If AscB(clow)>127 Then
'AscW会把二进制的中文双字节字符高位和低位反转,所以要先把中文的高低位反转
ccc=ccc & Chr(AscW(MidB(binstr,i+1,1) & clow))
skipflag=1
Else
ccc=ccc & Chr(AscB(clow))
End If
Else
skipflag=0
End If
Next
End If
bin2str=ccc
End Function
'把普通字符串转成二进制字符串函数
Function str2bin(varstr)
dim i,varchar,varasc
str2bin=""
For i=1 To Len(varstr)
varchar=mid(varstr,i,1)
varasc=Asc(varchar)
'asc对中文字符求出来的值可能为负数,
'加上65536就可求出它的无符号数值
'-1在机器内是用补码表示的0xffff,
'其无符号值为65535,65535=-1+65536
'其他负数依次类推。
If varasc<0 Then
varasc=varasc+65535
End If
'对中文的处理:把双字节低位和高位分开
If varasc>255 Then
varlow=Left(Hex(Asc(varchar)),2)
varhigh=right(Hex(Asc(varchar)),2)
str2bin=str2bin & chrB("&H" & varlow) & chrB("&H" & varhigh)
Else
str2bin=str2bin & chrB(AscB(varchar))
End If
Next
End Function
'取得文件名(去掉Path)
Function GetFileName(FullPath)
If FullPath<>"" Then
FullPath=StrReverse(FullPath)
if InStr(1,FullPath,"\")>0 then
FullPath=Left(FullPath,InStr(1,FullPath,"\")-1)
GetFileName=StrReverse(FullPath)
else
GetFileName=StrReverse(FullPath)
end if
Else
GetFileName=""
End If
End Function
%>
<%
sub GetUpload(FormData)
Dim DivStr,DivLen,PosOpenBoundary,PosCloseBoundary
Dim FieldNameStart,FormFieldName,FieldNameSize,FormFieldData,DataStart,DataEnd,DataSize
Dim FieldFileNameStart,FormFileName,FieldFileNameSize
Dim FieldFileCTStart,FormFileCT,FieldFileCTSize
'分隔标志串(+CRLF),
DivStr=LeftB(FormData,InStrB(FormData,str2bin(VbCrLf))-1)
'分隔标志串长度
DivLen=LenB(DivStr)
PosOpenBoundary=InStrB(FormData,DivStr)
PosCloseBoundary=InStrB(PosOpenBoundary+1,FormData,DivStr)
Do until PosCloseBoundary=lenb(FormData) or PosCloseBoundary=0 '(PosOpenBoundary=lenb(FormData))
dim Field,FirstField,bIsFile
bIsFile=false
FormFieldName=""
Set Field=CreateObject("Scripting.Dictionary")
'Name起始位置(Name="xxxxx"),加6是因为[Name="]长度为6
FieldNameStart=InStrB(PosOpenBoundary,FormData,str2bin("name="))+6
FieldNameSize=InStrB(FieldNameStart,FormData,ChrB(34))-FieldNameStart'(")的ASC值=34
FormFieldName=bin2str(MidB(FormData,FieldNameStart,FieldNameSize))
'FileName起始位置(FileName="xxxxx")
FieldFileNameStart=InStrB(PosOpenBoundary,FormData,str2bin("filename="))+10
if PosCloseBoundary=0 then
PosCloseBoundary=lenb(FormData)
end if
If FieldFileNameStart<PosCloseBoundary And FieldFileNameStart>PosopenBoundary Then
FieldFileNameSize=InStrB(FieldFileNameStart,FormData,ChrB(34))-FieldFileNameStart '(")的ASC值=34
FormFileName=bin2str(MidB(FormData,FieldFileNameStart,FieldFileNameSize))
Field.Add "FilePath",FormFileName
Field.Add "FileName",GetFileName(FormFileName)
bIsFile=true
End If
'Content-Type起始位置(Content-Type: xxxxx)
FieldFileCTStart=InStrB(PosOpenBoundary,FormData,str2bin("Content-Type:"))+14
If FieldFileCTStart<PosCloseBoundary And FieldFileCTStart>PosOpenBoundary Then
FieldFileCTSize=InStrB(FieldFileCTStart,FormData,str2bin(VbCrLf & VbCrLf))-FieldFileCTStart
FormFileCT=bin2str(MidB(FormData,FieldFileCTStart,FieldFileCTSize))
Field.Add "ContentType",FormFileCT
End If
'数据起始位置:2个CRLF开始
If bIsFile Then
DataStart=InStrB(FieldFileCTStart,FormData,str2bin(VbCrLf))+4
DataEnd=InstrB(DataStart,FormData,DivStr)-2
FormFieldData=MidB(FormData,DataStart,DataEnd-DataStart)
Else
DataStart=InstrB(FieldNameStart,FormData,str2bin(VbCrLf))+4
DataEnd=InstrB(DataStart,RequestBin,DivStr)-2
FormFieldData=bin2str(MidB(FormData,DataStart,DataEnd-DataStart))
End If
Field.Add "Value",FormFieldData
Field.Add "FieldDataBgnPos",DataStart
Field.Add "FieldDataLength",DataEnd-DataStart
if UploadRequest.Exists(FormFieldName) then
iCount=UploadRequest(FormFieldName).Count
UploadRequest(FormFieldName).Add iCount,Field
else
Set FirstField=CreateObject("Scripting.Dictionary")
FirstField.Add 0,Field
UploadRequest.Add FormFieldName,FirstField
end if
PosOpenBoundary=PosCloseBoundary
PosCloseBoundary=InStrB(PosOpenBoundary+1,FormData,DivStr)
loop
End sub
'把二进制字符串转换成普通字符串函数
Function bin2str(binstr)
Dim varlen,clow,ccc,skipflag,i
'中文字符Skip标志
skipflag=0
ccc=""
If Not IsNull(binstr) Then
varlen=LenB(binstr)
For i=1 To varlen
If skipflag=0 Then
clow=MidB(binstr,i,1)
'判断是否中文的字符
If AscB(clow)>127 Then
'AscW会把二进制的中文双字节字符高位和低位反转,所以要先把中文的高低位反转
ccc=ccc & Chr(AscW(MidB(binstr,i+1,1) & clow))
skipflag=1
Else
ccc=ccc & Chr(AscB(clow))
End If
Else
skipflag=0
End If
Next
End If
bin2str=ccc
End Function
'把普通字符串转成二进制字符串函数
Function str2bin(varstr)
dim i,varchar,varasc
str2bin=""
For i=1 To Len(varstr)
varchar=mid(varstr,i,1)
varasc=Asc(varchar)
'asc对中文字符求出来的值可能为负数,
'加上65536就可求出它的无符号数值
'-1在机器内是用补码表示的0xffff,
'其无符号值为65535,65535=-1+65536
'其他负数依次类推。
If varasc<0 Then
varasc=varasc+65535
End If
'对中文的处理:把双字节低位和高位分开
If varasc>255 Then
varlow=Left(Hex(Asc(varchar)),2)
varhigh=right(Hex(Asc(varchar)),2)
str2bin=str2bin & chrB("&H" & varlow) & chrB("&H" & varhigh)
Else
str2bin=str2bin & chrB(AscB(varchar))
End If
Next
End Function
'取得文件名(去掉Path)
Function GetFileName(FullPath)
If FullPath<>"" Then
FullPath=StrReverse(FullPath)
if InStr(1,FullPath,"\")>0 then
FullPath=Left(FullPath,InStr(1,FullPath,"\")-1)
GetFileName=StrReverse(FullPath)
else
GetFileName=StrReverse(FullPath)
end if
Else
GetFileName=""
End If
End Function
%>
#4
<!--#INCLUDE FILE="../../FUNCTIONS/PUBLIC_FUNCTIONS.ASP" -->
<!--#INCLUDE FILE="../../FUNCTIONS/OOCL_FUNCTIONS.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/LOCAL_VARIABLES.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/AUTHENTICATE.ASP"-->
<%
DocInx=Request.QueryString("DocInx")
status=false
if DocInx<>"" then
If ConnectDB("[LSD DSN Name]",oConn,false) Then
set oRs=CreateObject("ADODB.Recordset")
strSQL="(SELECT 1 AS TYPE,Attachment_record_no,Comment FROM Doc_filing_index_attachment"
strSQL=strSQL & " WHERE Doc_index=" & DocInx & ")"
strSQL=strSQL & " UNION (SELECT -1,CAST(status AS NVARCHAR),CAST(File_status AS NVARCHAR) FROM Doc_filing_index"
strSQL=strSQL & " WHERE Doc_index_record_no=" & DocInx & ") ORDER BY TYPE DESC"
oRs.Open strSQL,oConn,1,1
if not oRs.EOF then
AttachmentArray=oRs.GetRows()
status=CBool(AttachmentArray(1,UBound(AttachmentArray,2)))
end if
oRs.Close
strSQL="SELECT Laserfiche_key,Comment"
strSQL=strSQL & " FROM doc_filing_index_Laserfiche WHERE doc_filing_index_no=" & DocInx
oRs.Open strSQL,oConn,1,1
if not oRs.EOF then
LaserficheArray=oRs.GetRows()
end if
oRs.Close
else
bOOCLIsErr=true
strOOCLErrMsg=strOOCLErrMsg & arrUnknowErr(0)
end if
FreeDBRes
end if
%>
<HTML>
<HEAD>
<meta http-equiv='Content-Type' content='text/html; charset=<%=Find_ini("[Charset]")%>'>
<link REL="STYLESHEET" TYPE="text/css" HREF="<%=strCSSPath%>pagestyle.css">
<script language="javascript" src="../../Functions/Functions.js"></script>
<script language=vbscript src="../../functions/functions.vbs"></script>
<script language=javascript src="../includes/common.js"></script>
<script language=javascript>
document.onreadystatechange=fnStartInit;
<%
if Request.QueryString("ToNext")="yes" then
%>
parent.SelectPage(0)
<%
end if
%>
function CheckData()
{
if(parent.document.all.DocInx.value=="")
{
alert("<%=InfoMsg(24)%>")
return false;
}
else
{
document.forms[0].action="DOCUMENT_FILING_INDEX_ADD_ATTACHMENTS_DB.ASP?DocInx=" + parent.document.all.DocInx.value;
if(confirm("<%=InfoMsg(29)%>"))
{
return true;
}
else
{
return false;
}
}
}
</script>
</HEAD>
<body SCROLL=no>
<FORM ENCTYPE="multipart/form-data" method=post onsubmit="return CheckData()" action="DOCUMENT_FILING_INDEX_ADD_ATTACHMENTS_DB.ASP?DocInx=<%=DocInx%>">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr class="blue_bg">
<td width="10%">Attachment</td>
<td width="10%">Comment on attachment</td>
</tr>
<%
if IsArray(AttachmentArray) then
for i=LBound(AttachmentArray,2) to UBound(AttachmentArray,2)
if AttachmentArray(0,i)<>1 then exit for
%>
<TR>
<TD><A href="../REVIEW/COMMON_PICTURE_SHOW.ASP?ID=<%=AttachmentArray(1,i)%>"><%=AttachmentArray(1,i)%></A></TD>
<TD><%=dfTextToHTML(AttachmentArray(2,i))%></TD>
</TR>
<%
next
end if
%>
<tr>
<td width="10%">
<INPUT class="input" name=Attachment type=file size="23" onkeypress="return false;">
</td>
<td width="10%">
<INPUT class="input" name="Comment" size="40" maxlength=255>
</td>
</tr>
<tr>
<td width="10%"> </td>
<td width="10%" align="right">
<INPUT class="btn" type="button" value="Add More Attachments" onclick="AddMoreRowEx()">
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr class="blue_bg">
<td colspan=2><B>Laserfiche Link</B></td>
</tr>
<tr class="blue_bg">
<td>Laserfiche Key</td><td>Comment</td>
</tr>
<%
if IsArray(LaserficheArray) then
for i=LBound(LaserficheArray,2) to UBound(LaserficheArray,2)
%>
<TR>
<TD><A href="<%=dfTextToHTML(LaserficheArray(0,i))%>"><%=dfTextToHTML(LaserficheArray(0,i))%></A></TD>
<TD><%=dfTextToHTML(LaserficheArray(1,i))%></TD>
</TR>
<%
next
end if
%>
<tr>
<td width="10%">
<INPUT class="input" name=Laserfiche_Key size="23">
</td>
<td width="10%">
<INPUT class="input" name="L_Comment" size="40" maxlength=255>
</td>
</tr>
<tr>
<td width="10%"> </td>
<td width="10%" align="right">
<INPUT class="btn" type="button" value="Add More Attachments" onclick="AddMoreRowEx()" id=button1 name=button1>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr align="center"><td colspan="2"> </td></tr>
<tr align="center">
<td colspan="2">
<%
if not status then%>
<input class="btn" type="submit" value="Save" name=Save>
<%end if%>
<input class="btn" type="submit" value="Confirm" name=Confirm>
</td>
</tr>
</table>
</form>
<%
if IsArray(AttachmentArray) then
%>
<SCRIPT language=javascript>
<%
if AttachmentArray(1,i)="1" then
%>
parent.document.all.FormStatus.value="Confirm";
<%
else
%>
parent.document.all.FormStatus.value="Save";
<%
end if
if AttachmentArray(2,i)="1" then
%>
parent.document.all.FileStatus.value="Active";
<%
else
%>
parent.document.all.FileStatus.value="Close";
<%
end if
%>
</SCRIPT>
<%
end if
if bOOCLIsErr Then Response.Write strOOCLErrMsg
%>
</body>
</HTML>
<!--#INCLUDE FILE="../../FUNCTIONS/OOCL_FUNCTIONS.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/LOCAL_VARIABLES.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/AUTHENTICATE.ASP"-->
<%
DocInx=Request.QueryString("DocInx")
status=false
if DocInx<>"" then
If ConnectDB("[LSD DSN Name]",oConn,false) Then
set oRs=CreateObject("ADODB.Recordset")
strSQL="(SELECT 1 AS TYPE,Attachment_record_no,Comment FROM Doc_filing_index_attachment"
strSQL=strSQL & " WHERE Doc_index=" & DocInx & ")"
strSQL=strSQL & " UNION (SELECT -1,CAST(status AS NVARCHAR),CAST(File_status AS NVARCHAR) FROM Doc_filing_index"
strSQL=strSQL & " WHERE Doc_index_record_no=" & DocInx & ") ORDER BY TYPE DESC"
oRs.Open strSQL,oConn,1,1
if not oRs.EOF then
AttachmentArray=oRs.GetRows()
status=CBool(AttachmentArray(1,UBound(AttachmentArray,2)))
end if
oRs.Close
strSQL="SELECT Laserfiche_key,Comment"
strSQL=strSQL & " FROM doc_filing_index_Laserfiche WHERE doc_filing_index_no=" & DocInx
oRs.Open strSQL,oConn,1,1
if not oRs.EOF then
LaserficheArray=oRs.GetRows()
end if
oRs.Close
else
bOOCLIsErr=true
strOOCLErrMsg=strOOCLErrMsg & arrUnknowErr(0)
end if
FreeDBRes
end if
%>
<HTML>
<HEAD>
<meta http-equiv='Content-Type' content='text/html; charset=<%=Find_ini("[Charset]")%>'>
<link REL="STYLESHEET" TYPE="text/css" HREF="<%=strCSSPath%>pagestyle.css">
<script language="javascript" src="../../Functions/Functions.js"></script>
<script language=vbscript src="../../functions/functions.vbs"></script>
<script language=javascript src="../includes/common.js"></script>
<script language=javascript>
document.onreadystatechange=fnStartInit;
<%
if Request.QueryString("ToNext")="yes" then
%>
parent.SelectPage(0)
<%
end if
%>
function CheckData()
{
if(parent.document.all.DocInx.value=="")
{
alert("<%=InfoMsg(24)%>")
return false;
}
else
{
document.forms[0].action="DOCUMENT_FILING_INDEX_ADD_ATTACHMENTS_DB.ASP?DocInx=" + parent.document.all.DocInx.value;
if(confirm("<%=InfoMsg(29)%>"))
{
return true;
}
else
{
return false;
}
}
}
</script>
</HEAD>
<body SCROLL=no>
<FORM ENCTYPE="multipart/form-data" method=post onsubmit="return CheckData()" action="DOCUMENT_FILING_INDEX_ADD_ATTACHMENTS_DB.ASP?DocInx=<%=DocInx%>">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr class="blue_bg">
<td width="10%">Attachment</td>
<td width="10%">Comment on attachment</td>
</tr>
<%
if IsArray(AttachmentArray) then
for i=LBound(AttachmentArray,2) to UBound(AttachmentArray,2)
if AttachmentArray(0,i)<>1 then exit for
%>
<TR>
<TD><A href="../REVIEW/COMMON_PICTURE_SHOW.ASP?ID=<%=AttachmentArray(1,i)%>"><%=AttachmentArray(1,i)%></A></TD>
<TD><%=dfTextToHTML(AttachmentArray(2,i))%></TD>
</TR>
<%
next
end if
%>
<tr>
<td width="10%">
<INPUT class="input" name=Attachment type=file size="23" onkeypress="return false;">
</td>
<td width="10%">
<INPUT class="input" name="Comment" size="40" maxlength=255>
</td>
</tr>
<tr>
<td width="10%"> </td>
<td width="10%" align="right">
<INPUT class="btn" type="button" value="Add More Attachments" onclick="AddMoreRowEx()">
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr class="blue_bg">
<td colspan=2><B>Laserfiche Link</B></td>
</tr>
<tr class="blue_bg">
<td>Laserfiche Key</td><td>Comment</td>
</tr>
<%
if IsArray(LaserficheArray) then
for i=LBound(LaserficheArray,2) to UBound(LaserficheArray,2)
%>
<TR>
<TD><A href="<%=dfTextToHTML(LaserficheArray(0,i))%>"><%=dfTextToHTML(LaserficheArray(0,i))%></A></TD>
<TD><%=dfTextToHTML(LaserficheArray(1,i))%></TD>
</TR>
<%
next
end if
%>
<tr>
<td width="10%">
<INPUT class="input" name=Laserfiche_Key size="23">
</td>
<td width="10%">
<INPUT class="input" name="L_Comment" size="40" maxlength=255>
</td>
</tr>
<tr>
<td width="10%"> </td>
<td width="10%" align="right">
<INPUT class="btn" type="button" value="Add More Attachments" onclick="AddMoreRowEx()" id=button1 name=button1>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr align="center"><td colspan="2"> </td></tr>
<tr align="center">
<td colspan="2">
<%
if not status then%>
<input class="btn" type="submit" value="Save" name=Save>
<%end if%>
<input class="btn" type="submit" value="Confirm" name=Confirm>
</td>
</tr>
</table>
</form>
<%
if IsArray(AttachmentArray) then
%>
<SCRIPT language=javascript>
<%
if AttachmentArray(1,i)="1" then
%>
parent.document.all.FormStatus.value="Confirm";
<%
else
%>
parent.document.all.FormStatus.value="Save";
<%
end if
if AttachmentArray(2,i)="1" then
%>
parent.document.all.FileStatus.value="Active";
<%
else
%>
parent.document.all.FileStatus.value="Close";
<%
end if
%>
</SCRIPT>
<%
end if
if bOOCLIsErr Then Response.Write strOOCLErrMsg
%>
</body>
</HTML>
#5
<!--#INCLUDE FILE="../../FUNCTIONS/PUBLIC_FUNCTIONS.ASP" -->
<!--#INCLUDE FILE="../../FUNCTIONS/OOCL_FUNCTIONS.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/LOCAL_VARIABLES.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/AUTHENTICATE.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/FILEUPLOAD.ASP"-->
<%
if UCase(Request.ServerVariables("REQUEST_METHOD"))<>"POST" then
Response.Redirect Request.ServerVariables("HTTP_REFERER")
end if
DocInx=Request.QueryString("DocInx")
UserFullName=dfStrCheckSingle(UserFullName)
if DocInx<>"" then
Set UploadRequest=CreateObject("Scripting.Dictionary")
RequestBin=Request.BinaryRead(Request.TotalBytes)
GetUpload RequestBin
If ConnectDB("[LSD DSN Name]",oConn,false) Then
if UploadRequest.Exists("Confirm") then '0=Confirm
strSQL="UPDATE Doc_filing_index SET Status=1 WHERE Doc_Index_Record_No=" & DocInx
oConn.Execute strSQL
end if
set oRs=CreateObject("ADODB.Recordset")
oRs.Open "Doc_filing_index_attachment",oConn,1,3,2
if Err.number<>0 then
Set oRs=Nothing
bOOCLIsErr=true
strOOCLErrMsg=strOOCLErrMsg & arrUnknowErr(2)
else
for i=0 to UploadRequest("Comment").count-1
if len(UploadRequest("Attachment")(i)("Value"))>0 then
FileName=dfStrCheckSingle(UploadRequest("Attachment")(i)("FileName"))
ContentType=dfStrCheckSingle(UploadRequest("Attachment")(i)("ContentType"))
Comment=dfStrCheckSingle(UploadRequest("Attachment")(i)("Comment"))
oRs.AddNew
oRs("Doc_index")=CInt(Request.QueryString("DocInx"))
oRs("Image_file").AppendChunk UploadRequest("Attachment")(i)("Value")
oRs("Image_type")=ContentType
oRs("Comment")=UploadRequest("Comment")(i)("Value")
strSQL="IF EXISTS(SELECT Doc_index_record_no FROM Doc_filing_index"
strSQL=strSQL & " WHERE Doc_index_record_no=" & DocInx & " AND Status=1)"
strSQL=strSQL & " BEGIN"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Image_file',N'NULL',N'" & FileName & "');"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Image_type',N'NULL',N'" & ContentType & "');"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Comment',N'NULL',N'" & Comment & "');"
strSQL=strSQL & " END"
oConn.Execute strSQL
oRs.Update
end if
next
oRs.Close
end if
for i=0 to UploadRequest("Laserfiche_Key").Count-1
if UploadRequest("Laserfiche_Key")(i)("Value")<>"" then
LaserficheKey=dfStrCheckSingle(UploadRequest("Laserfiche_Key")(i)("Value"))
Comment=dfStrCheckSingle(UploadRequest("L_Comment")(i)("Value"))
strSQL="INSERT doc_filing_index_Laserfiche(Laserfiche_Key,Comment,doc_filing_index_no)"
strSQL=strSQL & " VALUES('" & LaserficheKey & "',N'" & Comment & "'," & DocInx & ");"
strSQL=strSQL & " IF EXISTS(SELECT Doc_index_record_no FROM Doc_filing_index"
strSQL=strSQL & " WHERE Doc_index_record_no=" & DocInx & " AND Status=1)"
strSQL=strSQL & " BEGIN"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Laserfiche Key',N'NULL',N'" & LaserficheKey & "');"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Comment',N'NULL',N'" & Comment & "');"
strSQL=strSQL & " END"
oConn.Execute strSQL
end if
next
else
bOOCLIsErr=true
strOOCLErrMsg=strOOCLErrMsg & arrUnknowErr(0)
end if
FreeDBRes
if bOOCLIsErr Then
Response.Write strOOCLErrMsg
end if
BackURL="DOCUMENT_FILING_INDEX_ADD_ATTACHMENTS_INC.ASP"
BackURL=BackURL & "?DocInx=" & Request.QueryString("DocInx")
BackURL=BackURL & "&ToNext=yes"
Response.Redirect BackURL
else
Response.Redirect Request.ServerVariables("HTTP_REFERER")
end if
%>
<!--#INCLUDE FILE="../../FUNCTIONS/OOCL_FUNCTIONS.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/LOCAL_VARIABLES.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/AUTHENTICATE.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/FILEUPLOAD.ASP"-->
<%
if UCase(Request.ServerVariables("REQUEST_METHOD"))<>"POST" then
Response.Redirect Request.ServerVariables("HTTP_REFERER")
end if
DocInx=Request.QueryString("DocInx")
UserFullName=dfStrCheckSingle(UserFullName)
if DocInx<>"" then
Set UploadRequest=CreateObject("Scripting.Dictionary")
RequestBin=Request.BinaryRead(Request.TotalBytes)
GetUpload RequestBin
If ConnectDB("[LSD DSN Name]",oConn,false) Then
if UploadRequest.Exists("Confirm") then '0=Confirm
strSQL="UPDATE Doc_filing_index SET Status=1 WHERE Doc_Index_Record_No=" & DocInx
oConn.Execute strSQL
end if
set oRs=CreateObject("ADODB.Recordset")
oRs.Open "Doc_filing_index_attachment",oConn,1,3,2
if Err.number<>0 then
Set oRs=Nothing
bOOCLIsErr=true
strOOCLErrMsg=strOOCLErrMsg & arrUnknowErr(2)
else
for i=0 to UploadRequest("Comment").count-1
if len(UploadRequest("Attachment")(i)("Value"))>0 then
FileName=dfStrCheckSingle(UploadRequest("Attachment")(i)("FileName"))
ContentType=dfStrCheckSingle(UploadRequest("Attachment")(i)("ContentType"))
Comment=dfStrCheckSingle(UploadRequest("Attachment")(i)("Comment"))
oRs.AddNew
oRs("Doc_index")=CInt(Request.QueryString("DocInx"))
oRs("Image_file").AppendChunk UploadRequest("Attachment")(i)("Value")
oRs("Image_type")=ContentType
oRs("Comment")=UploadRequest("Comment")(i)("Value")
strSQL="IF EXISTS(SELECT Doc_index_record_no FROM Doc_filing_index"
strSQL=strSQL & " WHERE Doc_index_record_no=" & DocInx & " AND Status=1)"
strSQL=strSQL & " BEGIN"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Image_file',N'NULL',N'" & FileName & "');"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Image_type',N'NULL',N'" & ContentType & "');"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Comment',N'NULL',N'" & Comment & "');"
strSQL=strSQL & " END"
oConn.Execute strSQL
oRs.Update
end if
next
oRs.Close
end if
for i=0 to UploadRequest("Laserfiche_Key").Count-1
if UploadRequest("Laserfiche_Key")(i)("Value")<>"" then
LaserficheKey=dfStrCheckSingle(UploadRequest("Laserfiche_Key")(i)("Value"))
Comment=dfStrCheckSingle(UploadRequest("L_Comment")(i)("Value"))
strSQL="INSERT doc_filing_index_Laserfiche(Laserfiche_Key,Comment,doc_filing_index_no)"
strSQL=strSQL & " VALUES('" & LaserficheKey & "',N'" & Comment & "'," & DocInx & ");"
strSQL=strSQL & " IF EXISTS(SELECT Doc_index_record_no FROM Doc_filing_index"
strSQL=strSQL & " WHERE Doc_index_record_no=" & DocInx & " AND Status=1)"
strSQL=strSQL & " BEGIN"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Laserfiche Key',N'NULL',N'" & LaserficheKey & "');"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Comment',N'NULL',N'" & Comment & "');"
strSQL=strSQL & " END"
oConn.Execute strSQL
end if
next
else
bOOCLIsErr=true
strOOCLErrMsg=strOOCLErrMsg & arrUnknowErr(0)
end if
FreeDBRes
if bOOCLIsErr Then
Response.Write strOOCLErrMsg
end if
BackURL="DOCUMENT_FILING_INDEX_ADD_ATTACHMENTS_INC.ASP"
BackURL=BackURL & "?DocInx=" & Request.QueryString("DocInx")
BackURL=BackURL & "&ToNext=yes"
Response.Redirect BackURL
else
Response.Redirect Request.ServerVariables("HTTP_REFERER")
end if
%>
#6
谢谢你了!!实在感谢
#1
看来你们一直都没有解决http uncode的问题..
总是想方设法绕过多个field混合提交的可能..
这不问题就来了..
找找前面的贴子,有关于解码http 提交的二进制数据的内容
总是想方设法绕过多个field混合提交的可能..
这不问题就来了..
找找前面的贴子,有关于解码http 提交的二进制数据的内容
#2
请高手指教!!实在不懂!
#3
FILEUPLOAD.ASP
<%
sub GetUpload(FormData)
Dim DivStr,DivLen,PosOpenBoundary,PosCloseBoundary
Dim FieldNameStart,FormFieldName,FieldNameSize,FormFieldData,DataStart,DataEnd,DataSize
Dim FieldFileNameStart,FormFileName,FieldFileNameSize
Dim FieldFileCTStart,FormFileCT,FieldFileCTSize
'分隔标志串(+CRLF),
DivStr=LeftB(FormData,InStrB(FormData,str2bin(VbCrLf))-1)
'分隔标志串长度
DivLen=LenB(DivStr)
PosOpenBoundary=InStrB(FormData,DivStr)
PosCloseBoundary=InStrB(PosOpenBoundary+1,FormData,DivStr)
Do until PosCloseBoundary=lenb(FormData) or PosCloseBoundary=0 '(PosOpenBoundary=lenb(FormData))
dim Field,FirstField,bIsFile
bIsFile=false
FormFieldName=""
Set Field=CreateObject("Scripting.Dictionary")
'Name起始位置(Name="xxxxx"),加6是因为[Name="]长度为6
FieldNameStart=InStrB(PosOpenBoundary,FormData,str2bin("name="))+6
FieldNameSize=InStrB(FieldNameStart,FormData,ChrB(34))-FieldNameStart'(")的ASC值=34
FormFieldName=bin2str(MidB(FormData,FieldNameStart,FieldNameSize))
'FileName起始位置(FileName="xxxxx")
FieldFileNameStart=InStrB(PosOpenBoundary,FormData,str2bin("filename="))+10
if PosCloseBoundary=0 then
PosCloseBoundary=lenb(FormData)
end if
If FieldFileNameStart<PosCloseBoundary And FieldFileNameStart>PosopenBoundary Then
FieldFileNameSize=InStrB(FieldFileNameStart,FormData,ChrB(34))-FieldFileNameStart '(")的ASC值=34
FormFileName=bin2str(MidB(FormData,FieldFileNameStart,FieldFileNameSize))
Field.Add "FilePath",FormFileName
Field.Add "FileName",GetFileName(FormFileName)
bIsFile=true
End If
'Content-Type起始位置(Content-Type: xxxxx)
FieldFileCTStart=InStrB(PosOpenBoundary,FormData,str2bin("Content-Type:"))+14
If FieldFileCTStart<PosCloseBoundary And FieldFileCTStart>PosOpenBoundary Then
FieldFileCTSize=InStrB(FieldFileCTStart,FormData,str2bin(VbCrLf & VbCrLf))-FieldFileCTStart
FormFileCT=bin2str(MidB(FormData,FieldFileCTStart,FieldFileCTSize))
Field.Add "ContentType",FormFileCT
End If
'数据起始位置:2个CRLF开始
If bIsFile Then
DataStart=InStrB(FieldFileCTStart,FormData,str2bin(VbCrLf))+4
DataEnd=InstrB(DataStart,FormData,DivStr)-2
FormFieldData=MidB(FormData,DataStart,DataEnd-DataStart)
Else
DataStart=InstrB(FieldNameStart,FormData,str2bin(VbCrLf))+4
DataEnd=InstrB(DataStart,RequestBin,DivStr)-2
FormFieldData=bin2str(MidB(FormData,DataStart,DataEnd-DataStart))
End If
Field.Add "Value",FormFieldData
Field.Add "FieldDataBgnPos",DataStart
Field.Add "FieldDataLength",DataEnd-DataStart
if UploadRequest.Exists(FormFieldName) then
iCount=UploadRequest(FormFieldName).Count
UploadRequest(FormFieldName).Add iCount,Field
else
Set FirstField=CreateObject("Scripting.Dictionary")
FirstField.Add 0,Field
UploadRequest.Add FormFieldName,FirstField
end if
PosOpenBoundary=PosCloseBoundary
PosCloseBoundary=InStrB(PosOpenBoundary+1,FormData,DivStr)
loop
End sub
'把二进制字符串转换成普通字符串函数
Function bin2str(binstr)
Dim varlen,clow,ccc,skipflag,i
'中文字符Skip标志
skipflag=0
ccc=""
If Not IsNull(binstr) Then
varlen=LenB(binstr)
For i=1 To varlen
If skipflag=0 Then
clow=MidB(binstr,i,1)
'判断是否中文的字符
If AscB(clow)>127 Then
'AscW会把二进制的中文双字节字符高位和低位反转,所以要先把中文的高低位反转
ccc=ccc & Chr(AscW(MidB(binstr,i+1,1) & clow))
skipflag=1
Else
ccc=ccc & Chr(AscB(clow))
End If
Else
skipflag=0
End If
Next
End If
bin2str=ccc
End Function
'把普通字符串转成二进制字符串函数
Function str2bin(varstr)
dim i,varchar,varasc
str2bin=""
For i=1 To Len(varstr)
varchar=mid(varstr,i,1)
varasc=Asc(varchar)
'asc对中文字符求出来的值可能为负数,
'加上65536就可求出它的无符号数值
'-1在机器内是用补码表示的0xffff,
'其无符号值为65535,65535=-1+65536
'其他负数依次类推。
If varasc<0 Then
varasc=varasc+65535
End If
'对中文的处理:把双字节低位和高位分开
If varasc>255 Then
varlow=Left(Hex(Asc(varchar)),2)
varhigh=right(Hex(Asc(varchar)),2)
str2bin=str2bin & chrB("&H" & varlow) & chrB("&H" & varhigh)
Else
str2bin=str2bin & chrB(AscB(varchar))
End If
Next
End Function
'取得文件名(去掉Path)
Function GetFileName(FullPath)
If FullPath<>"" Then
FullPath=StrReverse(FullPath)
if InStr(1,FullPath,"\")>0 then
FullPath=Left(FullPath,InStr(1,FullPath,"\")-1)
GetFileName=StrReverse(FullPath)
else
GetFileName=StrReverse(FullPath)
end if
Else
GetFileName=""
End If
End Function
%>
<%
sub GetUpload(FormData)
Dim DivStr,DivLen,PosOpenBoundary,PosCloseBoundary
Dim FieldNameStart,FormFieldName,FieldNameSize,FormFieldData,DataStart,DataEnd,DataSize
Dim FieldFileNameStart,FormFileName,FieldFileNameSize
Dim FieldFileCTStart,FormFileCT,FieldFileCTSize
'分隔标志串(+CRLF),
DivStr=LeftB(FormData,InStrB(FormData,str2bin(VbCrLf))-1)
'分隔标志串长度
DivLen=LenB(DivStr)
PosOpenBoundary=InStrB(FormData,DivStr)
PosCloseBoundary=InStrB(PosOpenBoundary+1,FormData,DivStr)
Do until PosCloseBoundary=lenb(FormData) or PosCloseBoundary=0 '(PosOpenBoundary=lenb(FormData))
dim Field,FirstField,bIsFile
bIsFile=false
FormFieldName=""
Set Field=CreateObject("Scripting.Dictionary")
'Name起始位置(Name="xxxxx"),加6是因为[Name="]长度为6
FieldNameStart=InStrB(PosOpenBoundary,FormData,str2bin("name="))+6
FieldNameSize=InStrB(FieldNameStart,FormData,ChrB(34))-FieldNameStart'(")的ASC值=34
FormFieldName=bin2str(MidB(FormData,FieldNameStart,FieldNameSize))
'FileName起始位置(FileName="xxxxx")
FieldFileNameStart=InStrB(PosOpenBoundary,FormData,str2bin("filename="))+10
if PosCloseBoundary=0 then
PosCloseBoundary=lenb(FormData)
end if
If FieldFileNameStart<PosCloseBoundary And FieldFileNameStart>PosopenBoundary Then
FieldFileNameSize=InStrB(FieldFileNameStart,FormData,ChrB(34))-FieldFileNameStart '(")的ASC值=34
FormFileName=bin2str(MidB(FormData,FieldFileNameStart,FieldFileNameSize))
Field.Add "FilePath",FormFileName
Field.Add "FileName",GetFileName(FormFileName)
bIsFile=true
End If
'Content-Type起始位置(Content-Type: xxxxx)
FieldFileCTStart=InStrB(PosOpenBoundary,FormData,str2bin("Content-Type:"))+14
If FieldFileCTStart<PosCloseBoundary And FieldFileCTStart>PosOpenBoundary Then
FieldFileCTSize=InStrB(FieldFileCTStart,FormData,str2bin(VbCrLf & VbCrLf))-FieldFileCTStart
FormFileCT=bin2str(MidB(FormData,FieldFileCTStart,FieldFileCTSize))
Field.Add "ContentType",FormFileCT
End If
'数据起始位置:2个CRLF开始
If bIsFile Then
DataStart=InStrB(FieldFileCTStart,FormData,str2bin(VbCrLf))+4
DataEnd=InstrB(DataStart,FormData,DivStr)-2
FormFieldData=MidB(FormData,DataStart,DataEnd-DataStart)
Else
DataStart=InstrB(FieldNameStart,FormData,str2bin(VbCrLf))+4
DataEnd=InstrB(DataStart,RequestBin,DivStr)-2
FormFieldData=bin2str(MidB(FormData,DataStart,DataEnd-DataStart))
End If
Field.Add "Value",FormFieldData
Field.Add "FieldDataBgnPos",DataStart
Field.Add "FieldDataLength",DataEnd-DataStart
if UploadRequest.Exists(FormFieldName) then
iCount=UploadRequest(FormFieldName).Count
UploadRequest(FormFieldName).Add iCount,Field
else
Set FirstField=CreateObject("Scripting.Dictionary")
FirstField.Add 0,Field
UploadRequest.Add FormFieldName,FirstField
end if
PosOpenBoundary=PosCloseBoundary
PosCloseBoundary=InStrB(PosOpenBoundary+1,FormData,DivStr)
loop
End sub
'把二进制字符串转换成普通字符串函数
Function bin2str(binstr)
Dim varlen,clow,ccc,skipflag,i
'中文字符Skip标志
skipflag=0
ccc=""
If Not IsNull(binstr) Then
varlen=LenB(binstr)
For i=1 To varlen
If skipflag=0 Then
clow=MidB(binstr,i,1)
'判断是否中文的字符
If AscB(clow)>127 Then
'AscW会把二进制的中文双字节字符高位和低位反转,所以要先把中文的高低位反转
ccc=ccc & Chr(AscW(MidB(binstr,i+1,1) & clow))
skipflag=1
Else
ccc=ccc & Chr(AscB(clow))
End If
Else
skipflag=0
End If
Next
End If
bin2str=ccc
End Function
'把普通字符串转成二进制字符串函数
Function str2bin(varstr)
dim i,varchar,varasc
str2bin=""
For i=1 To Len(varstr)
varchar=mid(varstr,i,1)
varasc=Asc(varchar)
'asc对中文字符求出来的值可能为负数,
'加上65536就可求出它的无符号数值
'-1在机器内是用补码表示的0xffff,
'其无符号值为65535,65535=-1+65536
'其他负数依次类推。
If varasc<0 Then
varasc=varasc+65535
End If
'对中文的处理:把双字节低位和高位分开
If varasc>255 Then
varlow=Left(Hex(Asc(varchar)),2)
varhigh=right(Hex(Asc(varchar)),2)
str2bin=str2bin & chrB("&H" & varlow) & chrB("&H" & varhigh)
Else
str2bin=str2bin & chrB(AscB(varchar))
End If
Next
End Function
'取得文件名(去掉Path)
Function GetFileName(FullPath)
If FullPath<>"" Then
FullPath=StrReverse(FullPath)
if InStr(1,FullPath,"\")>0 then
FullPath=Left(FullPath,InStr(1,FullPath,"\")-1)
GetFileName=StrReverse(FullPath)
else
GetFileName=StrReverse(FullPath)
end if
Else
GetFileName=""
End If
End Function
%>
#4
<!--#INCLUDE FILE="../../FUNCTIONS/PUBLIC_FUNCTIONS.ASP" -->
<!--#INCLUDE FILE="../../FUNCTIONS/OOCL_FUNCTIONS.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/LOCAL_VARIABLES.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/AUTHENTICATE.ASP"-->
<%
DocInx=Request.QueryString("DocInx")
status=false
if DocInx<>"" then
If ConnectDB("[LSD DSN Name]",oConn,false) Then
set oRs=CreateObject("ADODB.Recordset")
strSQL="(SELECT 1 AS TYPE,Attachment_record_no,Comment FROM Doc_filing_index_attachment"
strSQL=strSQL & " WHERE Doc_index=" & DocInx & ")"
strSQL=strSQL & " UNION (SELECT -1,CAST(status AS NVARCHAR),CAST(File_status AS NVARCHAR) FROM Doc_filing_index"
strSQL=strSQL & " WHERE Doc_index_record_no=" & DocInx & ") ORDER BY TYPE DESC"
oRs.Open strSQL,oConn,1,1
if not oRs.EOF then
AttachmentArray=oRs.GetRows()
status=CBool(AttachmentArray(1,UBound(AttachmentArray,2)))
end if
oRs.Close
strSQL="SELECT Laserfiche_key,Comment"
strSQL=strSQL & " FROM doc_filing_index_Laserfiche WHERE doc_filing_index_no=" & DocInx
oRs.Open strSQL,oConn,1,1
if not oRs.EOF then
LaserficheArray=oRs.GetRows()
end if
oRs.Close
else
bOOCLIsErr=true
strOOCLErrMsg=strOOCLErrMsg & arrUnknowErr(0)
end if
FreeDBRes
end if
%>
<HTML>
<HEAD>
<meta http-equiv='Content-Type' content='text/html; charset=<%=Find_ini("[Charset]")%>'>
<link REL="STYLESHEET" TYPE="text/css" HREF="<%=strCSSPath%>pagestyle.css">
<script language="javascript" src="../../Functions/Functions.js"></script>
<script language=vbscript src="../../functions/functions.vbs"></script>
<script language=javascript src="../includes/common.js"></script>
<script language=javascript>
document.onreadystatechange=fnStartInit;
<%
if Request.QueryString("ToNext")="yes" then
%>
parent.SelectPage(0)
<%
end if
%>
function CheckData()
{
if(parent.document.all.DocInx.value=="")
{
alert("<%=InfoMsg(24)%>")
return false;
}
else
{
document.forms[0].action="DOCUMENT_FILING_INDEX_ADD_ATTACHMENTS_DB.ASP?DocInx=" + parent.document.all.DocInx.value;
if(confirm("<%=InfoMsg(29)%>"))
{
return true;
}
else
{
return false;
}
}
}
</script>
</HEAD>
<body SCROLL=no>
<FORM ENCTYPE="multipart/form-data" method=post onsubmit="return CheckData()" action="DOCUMENT_FILING_INDEX_ADD_ATTACHMENTS_DB.ASP?DocInx=<%=DocInx%>">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr class="blue_bg">
<td width="10%">Attachment</td>
<td width="10%">Comment on attachment</td>
</tr>
<%
if IsArray(AttachmentArray) then
for i=LBound(AttachmentArray,2) to UBound(AttachmentArray,2)
if AttachmentArray(0,i)<>1 then exit for
%>
<TR>
<TD><A href="../REVIEW/COMMON_PICTURE_SHOW.ASP?ID=<%=AttachmentArray(1,i)%>"><%=AttachmentArray(1,i)%></A></TD>
<TD><%=dfTextToHTML(AttachmentArray(2,i))%></TD>
</TR>
<%
next
end if
%>
<tr>
<td width="10%">
<INPUT class="input" name=Attachment type=file size="23" onkeypress="return false;">
</td>
<td width="10%">
<INPUT class="input" name="Comment" size="40" maxlength=255>
</td>
</tr>
<tr>
<td width="10%"> </td>
<td width="10%" align="right">
<INPUT class="btn" type="button" value="Add More Attachments" onclick="AddMoreRowEx()">
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr class="blue_bg">
<td colspan=2><B>Laserfiche Link</B></td>
</tr>
<tr class="blue_bg">
<td>Laserfiche Key</td><td>Comment</td>
</tr>
<%
if IsArray(LaserficheArray) then
for i=LBound(LaserficheArray,2) to UBound(LaserficheArray,2)
%>
<TR>
<TD><A href="<%=dfTextToHTML(LaserficheArray(0,i))%>"><%=dfTextToHTML(LaserficheArray(0,i))%></A></TD>
<TD><%=dfTextToHTML(LaserficheArray(1,i))%></TD>
</TR>
<%
next
end if
%>
<tr>
<td width="10%">
<INPUT class="input" name=Laserfiche_Key size="23">
</td>
<td width="10%">
<INPUT class="input" name="L_Comment" size="40" maxlength=255>
</td>
</tr>
<tr>
<td width="10%"> </td>
<td width="10%" align="right">
<INPUT class="btn" type="button" value="Add More Attachments" onclick="AddMoreRowEx()" id=button1 name=button1>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr align="center"><td colspan="2"> </td></tr>
<tr align="center">
<td colspan="2">
<%
if not status then%>
<input class="btn" type="submit" value="Save" name=Save>
<%end if%>
<input class="btn" type="submit" value="Confirm" name=Confirm>
</td>
</tr>
</table>
</form>
<%
if IsArray(AttachmentArray) then
%>
<SCRIPT language=javascript>
<%
if AttachmentArray(1,i)="1" then
%>
parent.document.all.FormStatus.value="Confirm";
<%
else
%>
parent.document.all.FormStatus.value="Save";
<%
end if
if AttachmentArray(2,i)="1" then
%>
parent.document.all.FileStatus.value="Active";
<%
else
%>
parent.document.all.FileStatus.value="Close";
<%
end if
%>
</SCRIPT>
<%
end if
if bOOCLIsErr Then Response.Write strOOCLErrMsg
%>
</body>
</HTML>
<!--#INCLUDE FILE="../../FUNCTIONS/OOCL_FUNCTIONS.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/LOCAL_VARIABLES.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/AUTHENTICATE.ASP"-->
<%
DocInx=Request.QueryString("DocInx")
status=false
if DocInx<>"" then
If ConnectDB("[LSD DSN Name]",oConn,false) Then
set oRs=CreateObject("ADODB.Recordset")
strSQL="(SELECT 1 AS TYPE,Attachment_record_no,Comment FROM Doc_filing_index_attachment"
strSQL=strSQL & " WHERE Doc_index=" & DocInx & ")"
strSQL=strSQL & " UNION (SELECT -1,CAST(status AS NVARCHAR),CAST(File_status AS NVARCHAR) FROM Doc_filing_index"
strSQL=strSQL & " WHERE Doc_index_record_no=" & DocInx & ") ORDER BY TYPE DESC"
oRs.Open strSQL,oConn,1,1
if not oRs.EOF then
AttachmentArray=oRs.GetRows()
status=CBool(AttachmentArray(1,UBound(AttachmentArray,2)))
end if
oRs.Close
strSQL="SELECT Laserfiche_key,Comment"
strSQL=strSQL & " FROM doc_filing_index_Laserfiche WHERE doc_filing_index_no=" & DocInx
oRs.Open strSQL,oConn,1,1
if not oRs.EOF then
LaserficheArray=oRs.GetRows()
end if
oRs.Close
else
bOOCLIsErr=true
strOOCLErrMsg=strOOCLErrMsg & arrUnknowErr(0)
end if
FreeDBRes
end if
%>
<HTML>
<HEAD>
<meta http-equiv='Content-Type' content='text/html; charset=<%=Find_ini("[Charset]")%>'>
<link REL="STYLESHEET" TYPE="text/css" HREF="<%=strCSSPath%>pagestyle.css">
<script language="javascript" src="../../Functions/Functions.js"></script>
<script language=vbscript src="../../functions/functions.vbs"></script>
<script language=javascript src="../includes/common.js"></script>
<script language=javascript>
document.onreadystatechange=fnStartInit;
<%
if Request.QueryString("ToNext")="yes" then
%>
parent.SelectPage(0)
<%
end if
%>
function CheckData()
{
if(parent.document.all.DocInx.value=="")
{
alert("<%=InfoMsg(24)%>")
return false;
}
else
{
document.forms[0].action="DOCUMENT_FILING_INDEX_ADD_ATTACHMENTS_DB.ASP?DocInx=" + parent.document.all.DocInx.value;
if(confirm("<%=InfoMsg(29)%>"))
{
return true;
}
else
{
return false;
}
}
}
</script>
</HEAD>
<body SCROLL=no>
<FORM ENCTYPE="multipart/form-data" method=post onsubmit="return CheckData()" action="DOCUMENT_FILING_INDEX_ADD_ATTACHMENTS_DB.ASP?DocInx=<%=DocInx%>">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr class="blue_bg">
<td width="10%">Attachment</td>
<td width="10%">Comment on attachment</td>
</tr>
<%
if IsArray(AttachmentArray) then
for i=LBound(AttachmentArray,2) to UBound(AttachmentArray,2)
if AttachmentArray(0,i)<>1 then exit for
%>
<TR>
<TD><A href="../REVIEW/COMMON_PICTURE_SHOW.ASP?ID=<%=AttachmentArray(1,i)%>"><%=AttachmentArray(1,i)%></A></TD>
<TD><%=dfTextToHTML(AttachmentArray(2,i))%></TD>
</TR>
<%
next
end if
%>
<tr>
<td width="10%">
<INPUT class="input" name=Attachment type=file size="23" onkeypress="return false;">
</td>
<td width="10%">
<INPUT class="input" name="Comment" size="40" maxlength=255>
</td>
</tr>
<tr>
<td width="10%"> </td>
<td width="10%" align="right">
<INPUT class="btn" type="button" value="Add More Attachments" onclick="AddMoreRowEx()">
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr class="blue_bg">
<td colspan=2><B>Laserfiche Link</B></td>
</tr>
<tr class="blue_bg">
<td>Laserfiche Key</td><td>Comment</td>
</tr>
<%
if IsArray(LaserficheArray) then
for i=LBound(LaserficheArray,2) to UBound(LaserficheArray,2)
%>
<TR>
<TD><A href="<%=dfTextToHTML(LaserficheArray(0,i))%>"><%=dfTextToHTML(LaserficheArray(0,i))%></A></TD>
<TD><%=dfTextToHTML(LaserficheArray(1,i))%></TD>
</TR>
<%
next
end if
%>
<tr>
<td width="10%">
<INPUT class="input" name=Laserfiche_Key size="23">
</td>
<td width="10%">
<INPUT class="input" name="L_Comment" size="40" maxlength=255>
</td>
</tr>
<tr>
<td width="10%"> </td>
<td width="10%" align="right">
<INPUT class="btn" type="button" value="Add More Attachments" onclick="AddMoreRowEx()" id=button1 name=button1>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr align="center"><td colspan="2"> </td></tr>
<tr align="center">
<td colspan="2">
<%
if not status then%>
<input class="btn" type="submit" value="Save" name=Save>
<%end if%>
<input class="btn" type="submit" value="Confirm" name=Confirm>
</td>
</tr>
</table>
</form>
<%
if IsArray(AttachmentArray) then
%>
<SCRIPT language=javascript>
<%
if AttachmentArray(1,i)="1" then
%>
parent.document.all.FormStatus.value="Confirm";
<%
else
%>
parent.document.all.FormStatus.value="Save";
<%
end if
if AttachmentArray(2,i)="1" then
%>
parent.document.all.FileStatus.value="Active";
<%
else
%>
parent.document.all.FileStatus.value="Close";
<%
end if
%>
</SCRIPT>
<%
end if
if bOOCLIsErr Then Response.Write strOOCLErrMsg
%>
</body>
</HTML>
#5
<!--#INCLUDE FILE="../../FUNCTIONS/PUBLIC_FUNCTIONS.ASP" -->
<!--#INCLUDE FILE="../../FUNCTIONS/OOCL_FUNCTIONS.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/LOCAL_VARIABLES.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/AUTHENTICATE.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/FILEUPLOAD.ASP"-->
<%
if UCase(Request.ServerVariables("REQUEST_METHOD"))<>"POST" then
Response.Redirect Request.ServerVariables("HTTP_REFERER")
end if
DocInx=Request.QueryString("DocInx")
UserFullName=dfStrCheckSingle(UserFullName)
if DocInx<>"" then
Set UploadRequest=CreateObject("Scripting.Dictionary")
RequestBin=Request.BinaryRead(Request.TotalBytes)
GetUpload RequestBin
If ConnectDB("[LSD DSN Name]",oConn,false) Then
if UploadRequest.Exists("Confirm") then '0=Confirm
strSQL="UPDATE Doc_filing_index SET Status=1 WHERE Doc_Index_Record_No=" & DocInx
oConn.Execute strSQL
end if
set oRs=CreateObject("ADODB.Recordset")
oRs.Open "Doc_filing_index_attachment",oConn,1,3,2
if Err.number<>0 then
Set oRs=Nothing
bOOCLIsErr=true
strOOCLErrMsg=strOOCLErrMsg & arrUnknowErr(2)
else
for i=0 to UploadRequest("Comment").count-1
if len(UploadRequest("Attachment")(i)("Value"))>0 then
FileName=dfStrCheckSingle(UploadRequest("Attachment")(i)("FileName"))
ContentType=dfStrCheckSingle(UploadRequest("Attachment")(i)("ContentType"))
Comment=dfStrCheckSingle(UploadRequest("Attachment")(i)("Comment"))
oRs.AddNew
oRs("Doc_index")=CInt(Request.QueryString("DocInx"))
oRs("Image_file").AppendChunk UploadRequest("Attachment")(i)("Value")
oRs("Image_type")=ContentType
oRs("Comment")=UploadRequest("Comment")(i)("Value")
strSQL="IF EXISTS(SELECT Doc_index_record_no FROM Doc_filing_index"
strSQL=strSQL & " WHERE Doc_index_record_no=" & DocInx & " AND Status=1)"
strSQL=strSQL & " BEGIN"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Image_file',N'NULL',N'" & FileName & "');"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Image_type',N'NULL',N'" & ContentType & "');"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Comment',N'NULL',N'" & Comment & "');"
strSQL=strSQL & " END"
oConn.Execute strSQL
oRs.Update
end if
next
oRs.Close
end if
for i=0 to UploadRequest("Laserfiche_Key").Count-1
if UploadRequest("Laserfiche_Key")(i)("Value")<>"" then
LaserficheKey=dfStrCheckSingle(UploadRequest("Laserfiche_Key")(i)("Value"))
Comment=dfStrCheckSingle(UploadRequest("L_Comment")(i)("Value"))
strSQL="INSERT doc_filing_index_Laserfiche(Laserfiche_Key,Comment,doc_filing_index_no)"
strSQL=strSQL & " VALUES('" & LaserficheKey & "',N'" & Comment & "'," & DocInx & ");"
strSQL=strSQL & " IF EXISTS(SELECT Doc_index_record_no FROM Doc_filing_index"
strSQL=strSQL & " WHERE Doc_index_record_no=" & DocInx & " AND Status=1)"
strSQL=strSQL & " BEGIN"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Laserfiche Key',N'NULL',N'" & LaserficheKey & "');"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Comment',N'NULL',N'" & Comment & "');"
strSQL=strSQL & " END"
oConn.Execute strSQL
end if
next
else
bOOCLIsErr=true
strOOCLErrMsg=strOOCLErrMsg & arrUnknowErr(0)
end if
FreeDBRes
if bOOCLIsErr Then
Response.Write strOOCLErrMsg
end if
BackURL="DOCUMENT_FILING_INDEX_ADD_ATTACHMENTS_INC.ASP"
BackURL=BackURL & "?DocInx=" & Request.QueryString("DocInx")
BackURL=BackURL & "&ToNext=yes"
Response.Redirect BackURL
else
Response.Redirect Request.ServerVariables("HTTP_REFERER")
end if
%>
<!--#INCLUDE FILE="../../FUNCTIONS/OOCL_FUNCTIONS.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/LOCAL_VARIABLES.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/AUTHENTICATE.ASP"-->
<!--#INCLUDE FILE="../INCLUDES/FILEUPLOAD.ASP"-->
<%
if UCase(Request.ServerVariables("REQUEST_METHOD"))<>"POST" then
Response.Redirect Request.ServerVariables("HTTP_REFERER")
end if
DocInx=Request.QueryString("DocInx")
UserFullName=dfStrCheckSingle(UserFullName)
if DocInx<>"" then
Set UploadRequest=CreateObject("Scripting.Dictionary")
RequestBin=Request.BinaryRead(Request.TotalBytes)
GetUpload RequestBin
If ConnectDB("[LSD DSN Name]",oConn,false) Then
if UploadRequest.Exists("Confirm") then '0=Confirm
strSQL="UPDATE Doc_filing_index SET Status=1 WHERE Doc_Index_Record_No=" & DocInx
oConn.Execute strSQL
end if
set oRs=CreateObject("ADODB.Recordset")
oRs.Open "Doc_filing_index_attachment",oConn,1,3,2
if Err.number<>0 then
Set oRs=Nothing
bOOCLIsErr=true
strOOCLErrMsg=strOOCLErrMsg & arrUnknowErr(2)
else
for i=0 to UploadRequest("Comment").count-1
if len(UploadRequest("Attachment")(i)("Value"))>0 then
FileName=dfStrCheckSingle(UploadRequest("Attachment")(i)("FileName"))
ContentType=dfStrCheckSingle(UploadRequest("Attachment")(i)("ContentType"))
Comment=dfStrCheckSingle(UploadRequest("Attachment")(i)("Comment"))
oRs.AddNew
oRs("Doc_index")=CInt(Request.QueryString("DocInx"))
oRs("Image_file").AppendChunk UploadRequest("Attachment")(i)("Value")
oRs("Image_type")=ContentType
oRs("Comment")=UploadRequest("Comment")(i)("Value")
strSQL="IF EXISTS(SELECT Doc_index_record_no FROM Doc_filing_index"
strSQL=strSQL & " WHERE Doc_index_record_no=" & DocInx & " AND Status=1)"
strSQL=strSQL & " BEGIN"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Image_file',N'NULL',N'" & FileName & "');"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Image_type',N'NULL',N'" & ContentType & "');"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Comment',N'NULL',N'" & Comment & "');"
strSQL=strSQL & " END"
oConn.Execute strSQL
oRs.Update
end if
next
oRs.Close
end if
for i=0 to UploadRequest("Laserfiche_Key").Count-1
if UploadRequest("Laserfiche_Key")(i)("Value")<>"" then
LaserficheKey=dfStrCheckSingle(UploadRequest("Laserfiche_Key")(i)("Value"))
Comment=dfStrCheckSingle(UploadRequest("L_Comment")(i)("Value"))
strSQL="INSERT doc_filing_index_Laserfiche(Laserfiche_Key,Comment,doc_filing_index_no)"
strSQL=strSQL & " VALUES('" & LaserficheKey & "',N'" & Comment & "'," & DocInx & ");"
strSQL=strSQL & " IF EXISTS(SELECT Doc_index_record_no FROM Doc_filing_index"
strSQL=strSQL & " WHERE Doc_index_record_no=" & DocInx & " AND Status=1)"
strSQL=strSQL & " BEGIN"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Laserfiche Key',N'NULL',N'" & LaserficheKey & "');"
strSQL=strSQL & " INSERT Doc_filing_index_log(Doc_index,Log_date,Log_by,F_Action,"
strSQL=strSQL & " Column_name,Old_value,New_value)"
strSQL=strSQL & " VALUES(" & DocInx & ",GETDATE(),'" & UserFullName & "',"
strSQL=strSQL & " 'Add','Comment',N'NULL',N'" & Comment & "');"
strSQL=strSQL & " END"
oConn.Execute strSQL
end if
next
else
bOOCLIsErr=true
strOOCLErrMsg=strOOCLErrMsg & arrUnknowErr(0)
end if
FreeDBRes
if bOOCLIsErr Then
Response.Write strOOCLErrMsg
end if
BackURL="DOCUMENT_FILING_INDEX_ADD_ATTACHMENTS_INC.ASP"
BackURL=BackURL & "?DocInx=" & Request.QueryString("DocInx")
BackURL=BackURL & "&ToNext=yes"
Response.Redirect BackURL
else
Response.Redirect Request.ServerVariables("HTTP_REFERER")
end if
%>
#6
谢谢你了!!实在感谢