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

📄 upfile.asp

📁 一个超市管理系统
💻 ASP
字号:
<!-- #include file="setup.asp" -->
<!--#include FILE="upfile"-->

<%
if Request("menu")="up" then
On Error Resume Next
Set upl = Server.CreateObject("SoftArtisans.FileUp")
If -2147221005 = Err Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

set FileUP=new Upload_file 

FileUP.GetDate(-1)
formPath="images/upfile/"
set file=FileUP.file("file")
filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&"."&file.FileExt

if file.filesize > 102400 then
error2("文件大小不得超过 100 K\n当前的文件大小为 "&int(file.filesize/1024)&" K")
end if

select case LCase(file.FileExt)
case "gif"
img="[img]"&cluburl&"/"&filename&"[/img]"
case "jpg"
img="[img]"&cluburl&"/"&filename&"[/img]"
case "swf"
img="[flash]"&cluburl&"/"&filename&"[/flash]"
case "htm"
img="[img]"&cluburl&"/images/affix.gif[/img][url="&cluburl&"/"&filename&"]相关附件[/url]"
case "txt"
img="[img]"&cluburl&"/images/affix.gif[/img][url="&cluburl&"/"&filename&"]相关附件[/url]"
case "doc"
img="[img]"&cluburl&"/images/affix.gif[/img][url="&cluburl&"/"&filename&"]相关附件[/url]"
case "zip"
img="[img]"&cluburl&"/images/affix.gif[/img][url="&cluburl&"/"&filename&"]相关附件[/url]"
case "zip"
img="[img]"&cluburl&"/images/affix.gif[/img][url="&cluburl&"/"&filename&"]相关附件[/url]"
case else
error2("对不起,本服务器只支持GIF、JPG、HTM、TXT、DOC、ZIP、SWF格式的文件\n不支持 "&file.FileExt&" 格式的文件")
end select
if ""&file.filesize&""=Request.Cookies("TotalBytes") then
error2("请不要上传相同的文件!")
end if
file.SaveToFile Server.mappath(filename)
Response.Cookies("TotalBytes")=file.filesize
set FileUP=nothing
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


else


filename=""&year(date)&""&month(date)&""&day(date)&""&hour(time)&""&minute(time)&""&second(time)&""
select case ""&upl.ContentType&""
case "application/octet-stream"
error2("未知文件格式")
case "image/gif"
types="gif"
case "image/pjpeg"
types="jpg"
case "text/html"
types="htm"
case "text/plain"
types="txt"
case "application/msword"
types="doc"
case "application/x-zip-compressed"
types="zip"
case "application/x-shockwave-flash"
types="swf"
end select

filename="images/upfile/"&filename&"."&types&""

if upl.TotalBytes > 102400 then
error2("文件大小不得超过 100 K\n当前的文件大小为 "&int(upl.TotalBytes/1024)&" K")
end if

if types="gif" or types="jpg" then
img="[img]"&cluburl&"/"&filename&"[/img]"

elseif types="swf" then
img="[flash]"&cluburl&"/"&filename&"[/flash]"

elseif types="htm" or types="txt" or types="doc" or types="zip" then
img="[img]"&cluburl&"/images/affix.gif[/img][url="&cluburl&"/"&filename&"]相关附件[/url]"
else
error2("对不起,本服务器只支持GIF、JPG、HTM、TXT、DOC、ZIP、SWF格式的文件\n不支持 "&upl.ContentType&" 格式的文件")
end if

if ""&upl.TotalBytes&""=""&Request.Cookies("TotalBytes")&"" then
error2("请不要上传相同的文件!")
end if

upl.SaveAs Server.mappath(""&filename&"")
Response.Cookies("TotalBytes")=""&upl.TotalBytes&""
set upl=nothing



End If


response.write "<link href=images/skins/"&Request.Cookies("skins")&"/bbs.css rel=stylesheet><body topmargin=0  rightmargin=0  leftmargin=0><SCRIPT>parent.form.content.value+='\n"&img&"'</SCRIPT>"
response.write "<table cellpadding=0 cellspacing=0 width=100%  height=100% class=a4><tr><td><a target=_blank href="&filename&">"&cluburl&"/"&filename&"</a></td></tr></table>"
responseend

else

%>

<link href=images/skins/<%=Request.Cookies("skins")%>/bbs.css rel=stylesheet>
<body topmargin=0  rightmargin=0  leftmargin=0>
<form enctype=multipart/form-data method=post action=upfile.asp?menu=up>
<table cellpadding=0 cellspacing=0 width=100% class=a4>
<tr><td><IMG src=images/affix.gif>增加附件(100 K 以内)</td>
<td align=right><input type=file style=FONT-SIZE:9pt name=file size="30"> <input style=FONT-SIZE:9pt type="submit" value=" 上 传 " name=Submit></td></tr></table>
<%

end if
%>

⌨️ 快捷键说明

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