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

📄 upfile.asp

📁 ASP整套的建站源代码
💻 ASP
字号:
<!-- #include file="setup.asp" -->
<%
if Request("menu")="up" then

On Error Resume Next
Set upl = Server.CreateObject("SoftArtisans.FileUp")
If -2147221005 = Err Then
error2("本服务器不支持 SoftArtisans.FileUp 组件!")
End If

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

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&"/images/upfile/"&filename&"."&types&"[/img]"

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

elseif types="htm" or types="txt" or types="doc" or types="zip" then
img="[img]"&cluburl&"/images/affix.gif[/img][url="&cluburl&"/images/upfile/"&filename&"."&types&"]相关附件[/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("images/upfile/"&filename&"."&types&"")

Response.Cookies("TotalBytes")=""&upl.TotalBytes&""

set upl=nothing

response.write "<body topmargin=0 background=images/title_sub.gif><SCRIPT>parent.form.content.value+='\n"&img&"'</SCRIPT>"
response.write "<a target=_blank href=images/upfile/"&filename&"."&types&">"&cluburl&"/images/upfile/"&filename&"."&types&"</a>"
responseend

else

%>
<body topmargin=0 background="images/title_sub.gif">
<form enctype=multipart/form-data method=post action=?menu=up>
<table cellpadding=0 cellspacing=0 width=100%>
<tr><td><IMG src=images/affix.gif><font style=FONT-SIZE:9pt>增加附件(100 K 以内)</td>
<td align=right><input type=file style=FONT-SIZE:9pt name=f 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 + -