📄 upfile1.asp
字号:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="conn.asp" -->
<!--#include file=const.asp-->
<%Server.ScriptTimeout = 600%>
<% dim inname,datepath,infoldersize
inname=session("inname")
infoldersize=session("infoldersize")
datepath =year(now())&"/"&Month(now())&"/"&Day(now())&"/"
''将当前的日期和时间转为文件名
function makefilename(fname)
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
makefilename=fname
end function
if inname="" then
response.write "<script>alert('对不起!只有正式用户才能上传作品!');window.close();</script>"
response.end
end if
%>
<!--#include FILE="chklink.asp"-->
<!--#include FILE="uploadjs.inc"-->
<html>
<head>
<title>文件上传 | WLONG3D文件上传系统wlup3.5</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="FORUM.CSS" type="text/css">
</head>
<body>
<%
if session("mapurl")="" then
%>
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="middle">
<div align="center"><img src="../images/jjlogo.jpg" width="150" height="63"></div>
</td>
</tr>
<tr>
<td valign="top">
<div align="center"></div>
<hr size=2 width=100% align=center color="#6699FF" noshade>
<div align="center">
<%
dim upload,file,formName,iCount,flpath
set upload=new upload_5xSoft ''建立上传对象
response.write upload.Version&"<br><br>" ''显示上传类的版本
''在目录后加(/)
if right(filepath,1)<>"/" then filepath=filepath&"/"
select case pathset ''得到上传目录
case 0
UpFilePath = filepath
case 1
UpFilePath = FilePath & upload.objform("filepath")
case 2
session("UpFilePath") = FilePath
case 3
UpFilePath = makefile&inname&"/"
case 4
UpFilePath = makefile&datepath
end select
iCount=0
for each formName in upload.objfile ''列出所有上传了的文件
set file=upload.objfile(formName) ''生成一个文件对象
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
if infoldersize<>"" then ''检查用户文件夹是否有足够的空间
if file.FileSize>infoldersize then
Response.write "<script>alert('你的文件夹剩下的空间不足放置上传的文件!');history.back();</script>"
set upload=nothing
response.end
end if
end if
if file.FileSize<FileMaxSize then ''如果未超过文件大小限制
if FileType<>"" then '如果限制了上传文件类型
if Instr(FileType,GetExtendName(file.FileName)) then
TypeFlag = 1 '文件为允许的类型
else
TypeFlag = 0 '文件为不允许的类型
Response.write "不支持您所上传的文件类型:"
Response.write GetExtendName(file.FileName)
Response.write "<br>"
end if
else
TypeFlag = 1 '没有限制上传文件类型
end if
if TypeFlag = 1 then
vfname = makefilename(now())
if nameset = 1 then
fname = vfname & iCount & "." & GetExtendName(file.FileName)
elseif nameset =2 then
fname = file.FileName
elseif nameset = 3 then
fname = vfname & iCount & file.FileName
end if
if pathset=2 then
if instr(flmap,GetExtendName(file.FileName))>0 then
UpFilePath=session("UpFilePath")&"map/"
elseif instr(flsoft,GetExtendName(file.FileName))>0 then
UpFilePath=session("UpFilePath")&"soft/"
elseif instr(fltxt,GetExtendName(file.FileName))>0 then
UpFilePath=session("UpFilePath")&"txt/"
elseif instr(flvedio,GetExtendName(file.FileName))>0 then
UpFilePath=session("UpFilePath")&"vedio/"
elseif instr(flmidi,GetExtendName(file.FileName))>0 then
UpFilePath=session("UpFilePath")&"midi/"
end if
file.SaveAs Server.mappath(UpFilePath&fname)
response.write file.FilePath&file.FileName&" ("&file.FileSize&") => 上传文件成功! <br>"
response.write "你的文件路径是("&UpFilePath&fname&")<br>"
iCount=iCount+1
FileNameStr = UpFilePath&fname
session("mapurl")=FileNameStr
call addmap()
else
file.SaveAs Server.mappath(UpFilePath&fname) ''保存文件
response.write file.FilePath&file.FileName&" ("&file.FileSize&") => 上传文件成功! <br>"
response.write "你的文件路径是("&UpFilePath&fname&")<br>"
iCount=iCount+1
FileNameStr = UpFilePath&fname
session("mapurl")=FileNameStr
call addmap()
end if
end if
else
response.write "文件大小超出限制,您最多可以上传 "& FileMaxSize\1024 &"k个字节的文件数据"
exit for
end if
end if
set file=nothing
next
set upload=nothing ''删除此对象
if iCount>0 then
response.write "<br>成功地上传了"&iCount&" 个文件!"
else
response.write "<br>上传文件失败,请向管理员反应!"
response.write "<br>"&Msg&"<br><br><br><center> [<a href=""javascript:history.back();""><<返回</a>] [<a href=""MAKEFILE.ASP"">再上传文件</a>]</center>"
' response.end
end if
sub HtmEnd(Msg)
set upload=nothing
end sub
function GetExtendName(FileName)
dim ExtName
ExtName = LCase(FileName)
ExtName = mid(ExtName,instr(ExtName,".")+1)
if instr(ExtName,".")>0 then
dim i,sFor
sFor=split(ExtName,".")
for i=0 to uBound(sFor)
if i=uBound(sFor) then
GetExtendName=sFor(i)
end if
next
else
GetExtendName = ExtName
end if
end function
%>
</div>
</td>
</tr>
</table>
<% else
response.write "你还没有完成添加文件信息的工作!请完成所有的信息资料!<br>"
call addmap()
end if
set rs=nothing
sub addmap()
%>
<form name="form1" action="mapsave.asp" method="post">
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#6699FF">
<tr bgcolor="#99CCFF" bordercolor="#6699FF">
<td colspan="2" height="25">
<div align="center"><b>添加文件资料</b></div>
</td>
</tr>
<tr bgcolor="#eeeeee">
<td colspan="2">
<div align="center"><font color="#FF0000"><%= inname %></font>,请填写下列文件的说明资料
<input type="hidden" name="mapurl" value="<%=session("mapurl")%>">
</div>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="29%">
<div align="right">文件预览:</div>
</td>
<td width="71%">
<% select case Getgo(session("mapurl"))
case 0 %>
<%=Getmap(session("mapurl"))%>图片文件<br>
<img src="<%=session("mapurl")%>" width="100" height="100">
<% case 1 %>
<%=Getmap(session("mapurl"))%><a href="<%=session("mapurl")%>" target="_blank">下载文件</a>
<% case 2 %>
<%=Getmap(session("mapurl"))%><a href="<%=session("mapurl")%>" target="_blank">浏览文件</a>
<% end select %>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="29%" align="right">文件类型:</td>
<td width="71%">
<% Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from mapfl order by flid asc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
%>
目前没有文件分类!
<%else%>
<select name="mapfl" class="buttonface">
<%do while not rs.eof%>
<option value="<%=rs("mapfl")%>"><%=rs("mapfl")%></option>
<%
rs.movenext
loop
%>
</select>
<%
end if
rs.close
%>
<font color="#FF0000"><font color="#FF0000">*</font></font> <font color="#FF0000">请先选择!</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="29%">
<div align="right">文件名称:</div>
</td>
<td width="71%">
<input type="text" name="mapname" size="40" class="buttonface">
<font color="#FF0000">*必须填写</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="29%" valign="top">
<div align="right">文件说明:</div>
</td>
<td width="71%">
<textarea name="shuoming" cols="40" rows="4" class="buttonface"></textarea>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="29%" valign="top">
<div align="right">其他资料:</div>
</td>
<td width="71%">
<textarea name="softwave" cols="40" rows="4" class="buttonface"></textarea>
</td>
</tr>
<tr align="center" bgcolor="#99CCFF" bordercolor="#6699FF">
<td colspan="2">
<input type="submit" name="Submit" value="提交图片资料" class="buttonface">
<input type="reset" name="Submit2" value="重新填写资料" class="buttonface">
</td>
</tr>
<tr align="center" bgcolor="#FFCC00" bordercolor="#6699FF">
<td colspan="2" height="25">版权所有 © 2001-2004 <a href="http://www.wlong3d.com">wlong3d.com</a></td>
</tr>
</table>
</form>
<% end sub
conn.close
set conn=nothing
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -