📄 savepic.asp
字号:
<%
if Request.TotalBytes >409600 then
Request.BinaryRead Request.TotalBytes
Response.Clear
Response.Write "您选择的图片超过了400K,上传失败。请<a href=javascript:history.go(-1)>重新上传</a>。"
Response.End
end if
%>
<!--#include file="../include/odbc.asp" -->
<!--#include file="../include/myip.asp"-->
<%flag=split(Request.ServerVariables("query_string"),"&")
if flag(0)="" or flag(1)="" then
Response.Write "参数不全,保存数据失败!"
Response.End
end if
commendid=split(flag(0),"=")
menuid=split(flag(1),"=")
smallpic=split(flag(2),"=")
'/****************图片上传*********************/
Set ObjUpload = Server.CreateObject("UploadPhoto.clsUpload")
ObjUpload.sFilterString=".jpg;.bmp;.gif"
lFileLen=ObjUpload.DoUpload(smallpicphy)
tempFileName=trim(ObjUpload.sFileNewName)
set ObjUpload=nothing
if lFileLen=0 then
%>
<html><head>
<script language=javascript>
alert("文件上载出错,请重试!");
window.history.back();
</script>
</head></html>
<%
Response.End
end if
Application.Lock
'删除旧目标文件
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
if trim(smallpic(1))<>"" and fileobject.FileExists(smallpicphy&trim(smallpic(1))) then
InStream=FileObject.DeleteFile (smallpicphy&smallpic(1),1)
end if
set fileobject=nothing
'更新数据库记录
sql="update news2_specialcommend set smallpic='" &tempFileName & "' where commendid='" & commendid(1) & "'"
conn.execute sql
Application.UnLock%>
<script language=javascript>
alert("保存成功!");
</script>
<%'response.redirect "add.asp?menuid="&menuid(1)%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -