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

📄 upphoto.asp

📁 视频源代码 视频源代码
💻 ASP
字号:
<%Server.ScriptTimeout = 9999999%>
<!-- #include file="inc/conn.asp" -->
<!-- #include file="inc/picformat.asp" -->
<!-- #include file="inc/vip.asp" -->
<%if Session("filenum")="" and Session("editfilenum")="" then response.end
  if Session("photodata")="" then response.end

'图片格式
  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","2002-1-1 00:00:00",now())
  filenum =Session("filenum")
  if filenum="" then
    filenum =Session("editfilenum")
  end if

  sql="select top 1 * from "&Session("photodata")&"photo"
  rs.open sql,conn,1,3
  rs.addnew
  rs("id")		= picid
  rs("categoryid")	= Session("categoryid")
  rs("big").appendchunk mydata
  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 mydata	= nothing
  Set rs	= nothing
  Set conn	= nothing

  Response.redirect "photo.asp"
  Response.end%>

⌨️ 快捷键说明

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