📄 matrix3_ep_upload.asp
字号:
<!--#include file="const.asp"-->
<!-- #include file="matrix3_upload_inc.asp" -->
<!-- #include file="ep_config.asp" -->
<%
call opendb()
checkadmin()
call closedb()
dim uploadsize,uploadtype,uploadfolder,ep_folder,objFSO,objFile,filestr
uploadsize=200 'K
uploadtype="jpg,gif,bmp,jpeg"
ep_folder="expression"
dim upload,file,fname,filename,filesize,filepath,filetype,wordstr,ep_str
ep_str=epstr_all
set upload=new matrix3_upload
set file=upload.file("file1")
wordstr=trim(upload.form("wordstr"))
if instr(ep_str,";"&wordstr&";")>0 then
HtmEnd "快捷键:"&wordstr&" 已经存在!"
end if
if wordstr<>"" then
wordstr=replace(wordstr,";",";")
end if
if file.FileSize=0 then
HtmEnd "请先选择要上传的图片"
end if
filetype=getext(file.FileName)
filesize=file.FileSize
filename=file.FileName
if request.Cookies("matrix3")("matrix3_admin")<>"matrix3" then
if file.FileSize>uploadsize*1024 then
HtmEnd "文件过大 (不能超过"&uploadsize&"K)"
end if
end if
if checkext(filetype)=0 then
HtmEnd "文件格式不允许 "
end if
set objFSO=Server.CreateObject("Scripting.FileSystemObject")
if file.FileSize>0 then
if objFSO.FileExists(Server.MapPath(ep_folder&"/"&filename)) then
set objFSO=nothing
HtmEnd "添加失败:相同的文件名已经存在!"
end if
filepath=ep_folder&"/"&filename
file.SaveAs Server.mappath(filepath)
end if
if ep_str="" then
ep_str=wordstr&";"&filename
else
ep_str=ep_str&";"&wordstr&";"&filename
end if
filestr="<"&"%"&vbcrlf
filestr=filestr&"dim epstr_all"&vbcrlf&"epstr_all="""&ep_str&""""&vbcrlf
filestr=filestr&"function use_ep(epstr)"&vbcrlf
filestr=filestr&" use_ep="""""&vbcrlf
filestr=filestr&" if isnull(epstr) or epstr="""" then exit function"&vbcrlf
filestr=filestr&" dim ep_i,ep_n,ep,ep_str,ep_folder"&vbcrlf
filestr=filestr&" ep_folder="""&ep_folder&""""&vbcrlf
filestr=filestr&" ep_str="""&ep_str&""""&vbcrlf
filestr=filestr&" ep=split(ep_str,"";"")"&vbcrlf
filestr=filestr&" ep_n=(int)(ubound(ep)/2)"&vbcrlf
filestr=filestr&" ep_i=0"&vbcrlf
filestr=filestr&" do while ep_i<=ep_n"&vbcrlf
filestr=filestr&" epstr=replace(epstr,ep(2*ep_i),""<img border=0 src=""""""&ep_folder&""/""&ep(2*ep_i+1)&"""""" align=""""absmiddle"""">"")"&vbcrlf
filestr=filestr&" ep_i=ep_i+1"&vbcrlf
filestr=filestr&" loop"&vbcrlf
filestr=filestr&" use_ep=epstr"&vbcrlf
filestr=filestr&"end function"&vbcrlf
filestr=filestr&"%"&">"
set objFile=objFSO.CreateTextFile(server.mappath("ep_config.asp"),True)
objFile.write(filestr)
objFile.close
set objFile=nothing
set objFSO=nothing
set file=nothing
set upload=nothing
response.Redirect("matrix3_eplist.asp")
sub HtmEnd(Msg)
set file=nothing
set upload=nothing
response.write "<center> <font size=2>"
response.write Msg&"</font>"
response.write " · <a href=""javascript:history.back();"">返回</a> ·"
response.write "</center>"
response.end
end sub
function checkext(ext)
dim tmp_i,str
checkext=0
if isnull(ext) then
exit function
end if
if ext<>"" then
str=split(uploadtype,",")
for tmp_i=0 to ubound(str)
if str(tmp_i)=ext then
checkext=1
exit function
end if
next
end if
end function
function getext(filename)
if isnull(filename) then exit function
if instr(filename,".")>0 then
getext=lcase(mid(filename,instrRev(filename,".")+1))
else
getext=""
end if
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -