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

📄 uploadattachment.asp

📁 秘密网源代码 传闻拉了 100W风投
💻 ASP
字号:
<!-- #include file="Setup.asp" -->
<!--#include FILE="Utility/UpFile_Class.asp"-->
<%
if CookieUserName=empty then Alert("您还未登录")
if Request.ServerVariables("Request_method") = "POST" then


'生成目录
If IsObjInstalled("Scripting.FileSystemObject") Then
	Set fso = Server.CreateObject("Scripting.FileSystemObject")
	strDir="UpFile/UpAttachment/"&year(now)&"-"&month(now)&""
	if not fso.folderexists(Server.MapPath(strDir)) then fso.CreateFolder(Server.MapPath(strDir))
	Set fso = nothing
	UpFolder=""&year(now)&"-"&month(now)&"/"
end if

	UpFolder="UpFile/UpAttachment/"&UpFolder&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&""	'上传路径及文件名
	UpMaxFileSize=SiteConfig("MaxFileSize")*1024		'最大上传文件大小
	UpFileTypes=LCase(SiteConfig("UpFileTypes"))	'允许上传文件类型

%>
<!--#include FILE="Utility/UpFile.asp"-->
<%
	Rs.Open "[Wo_PostAttachments]",conn,1,3 
	Rs.addnew 
		Rs("UserName")=CookieUserName
		Rs("FileName")=FileName
		Rs("ContentType")=FileMIME
		Rs("ContentSize")=FileSize
		Rs("FilePath")=SaveFile
	Rs.update
	AttachmentID=Rs("UpFileID")
	Rs.close
%>

<script language="JavaScript">
var FileMIME="<%=FileMIME%>"
if (FileMIME.split ('/')[0]=="image"){
	img="[img]<%=SaveFile%>[/img]"
}
else{
	img="[url=<%=SaveFile%>][img]images/affix.gif[/img]<%=FileName%>[/url]"
}
parent.document.form.UpFileID.value+='<%=AttachmentID%>,';
parent.document.getElementById("UpFile").innerHTML+="<img src=images/affix.gif><a target=wh href=<%=SaveFile%> title='<%=FileName%>'><%=FileName%></a><br>";
if (navigator.appName == "Microsoft Internet Explorer"){
	parent.IframeID.focus();
	sel=parent.IframeID.document.selection.createRange();
	sel.pasteHTML(img);
}
else{
	parent.document.form.TextBody.value+=""+img+"\n";
}
parent.Wo_Modal.Close();
</script>
<%
else
Response.clear
%>
<title>添加附件</title>
<body style="FONT-SIZE:9pt;">
<form enctype=multipart/form-data method=Post action=?>
<input type=file name=file size="50"><br><br>
支持文件类型:<%=Ucase(replace(""&SiteConfig("UpFileTypes")&"","|","、"))%><br>
文件大小限制:<%=CheckSize(SiteConfig("MaxFileSize")*1024)%><br><br>
<center><input type="submit" value=" 上 传 "> 
<input type="button" onclick="javascript:parent.Wo_Modal.Close()" value=" 取 消 "></center>
</form>
</body>
<%
end if
%>

⌨️ 快捷键说明

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