⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upphoto.asp

📁 asp
💻 ASP
字号:
<!-- #include file="inc/conn.asp" -->
<!-- #include file="inc/picformat.asp" -->
<%
'图片格式
dim PicSize
PicSize=60

dim filesize,filedata,bncrlf,divider,datastart,dataend,mydata

Response.buffer=true
filesize=Request.totalbytes
if filesize>PicSize*1024 then
  call msgbox("您所选择上传的图片的大小约等于 "&int(filesize/1024)&"KB 不符合规格!应在 0.01KB~"&PicSize&"KB 之间.",1)
end if

filedata=Request.binaryread(filesize)
bncrlf=chrB(13) & chrB(10) 
divider=leftB(filedata,clng(instrB(filedata,bncrlf))-1)
datastart=instrb(filedata,bncrlf & bncrlf)+4 
dataend=instrb(datastart+1,filedata,divider)-datastart
mydata=midb(filedata,datastart,dataend)
arrayMessage=split(checkImageFormat(mydata),",")

if ubound(arrayMessage)=0 then
   call msgbox("上传相片不能为空!",1)
End if

if arrayMessage(1)<32 OR arrayMessage(1)>480 then
  call msgbox("您所选择上传的图片的高度 "&arrayMessage(1)&" 不符合规格!应在 32~480 之间",1)
end if

if arrayMessage(2)<32 or arrayMessage(2)>640 then
  call msgbox("您所选择上传的图片的宽度 "&arrayMessage(2)&" 不符合规格!应在 宽 32~480 之间",1)
end if


'图片保存
picid=DateDiff("s","2001-1-1 00:00:00",now())
sql="select top 1 * from "&Session("photodata")&"photo"
rs.open sql,conn,1,3
rs.addnew
rs("id")=picid
rs("big").appendchunk mydata
rs("categoryid")=Session("categoryid")
if Session("filenum")><"" then
  rs("filenum")	=Session("filenum")
else
  rs("filenum")	=Session("editfilenum")
end if
rs("otime")	=now
rs.update
rs.close

Session("photoup")=1

Set rs=nothing
Set conn=nothing
%>
<html>
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<body scroll="no" bgColor="#003063">
<script>
parent.document.all.upphoto.options[parent.document.all.upphoto.options.length] = new Option('<%=picid%>','<%=picid%>');
parent.document.all.EditContent.focus();
window.location.href='photo.asp';
</script>
<%response.end%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -