📄 coverload.asp
字号:
<!--#include file="upclass.asp"-->
<%
set upload=new clsUp '建立上传对象
upload.NoAllowExt="asp;asa;cer;aspx;cs;vb;js;" '设置上传类型的黑名单
filepath="../cover/" '上传路径
filepathname = "cover/"
filext="gif;jpg;png;"
upload.AllowExt=filext '设置上传类型的黑名单
upload.GetData (3072000) '取得上传数据,限制最大上传3M
if upload.form("act")="uploadfile" then
for each formName in upload.File
set file=upload.File(formName)
fileExt=lcase(file.FileExt) '得到的文件扩展名不含有.
if file.filesize<10 then
response.write "<span style=""font-family: 宋体; font-size: 9pt"">请先选择你要上传的文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
response.end
end if
if file.filesize>(3000*1024) then
response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 3000K 的图片文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
response.end
end if
if trim(file.fileext)<>"gif" and trim(file.fileext)<>"jpg" then
response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传jpg或gif格式的图片,系统将记录你的非法操作! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
response.end
end if
dtNow=Now()
randomize
ranNum=int(90000*rnd)+10000
filename1=year(dtNow) & right("0" & month(dtNow),2) & right("0" & day(dtNow),2) & right("0" & hour(dtNow),2) & right("0" & minute(dtNow),2) & right("0" & second(dtNow),2) & ranNum &"."&fileExt
filename=filepath&filename1
filelstname=filepathname&filename1
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
upload.SaveToFile formName,Server.mappath(FileName)
'这里可以存数据库
response.write "<script>"
response.Write"window.opener.document."&upload.form("FormName")&".cover.value='"&filelstname&"';"
response.Write"</script>"
%>
<script language="javascript">
window.alert("文件上传成功!请务修改链接地址!");
window.close();
</script>
<%
end if
set file=nothing
next
set upload=nothing
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -