📄 upfile.asp
字号:
<% Option Explicit %>
<!--#include file="conn.asp" -->
<!--#include file="functions/uploadfun.asp" -->
<%
Response.Buffer = True
Dim strFileTypes
Dim intMaxFileSize
Dim intForumID
Dim strMessageBoxType
Dim blnFileUploaded
Dim strErrorMessage
Dim strFileUploadPath
Dim saryFileUploadTypes
Dim intFileSize
Dim strUploadComponent
Dim lngErrorFileSize
Dim blnExtensionOK
Dim strFileName
If bannedIP() Then
Set rsConn = Nothing
adoCon.Close
Set adoCon = Nothing
Response.Redirect("nopermission.asp?M=IP")
End If
blnExtensionOK = True
intForumID = CInt(Request.QueryString("fid"))
strMessageBoxType = Request.QueryString("MSG")
strSQL = "SELECT timesbbs.* FROM timesbbs WHERE bbsid = " & intForumID & ";"
rsConn.Open strSQL, adoCon
If NOT rsConn.EOF Then
Call forumPermisisons(intForumID, intGroupID, CInt(rsConn("Read")), CInt(rsConn("Post")), CInt(rsConn("replypost")), 0, 0, 0, 0, 0, CInt(rsConn("Attachments")), CInt(rsConn("imgup")))
Else
Set rsConn = Nothing
adoCon.Close
Set adoCon = Nothing
Response.Redirect("index.asp")
End If
rsConn.Close
If blnAttachments AND blnRead AND (blnPost OR blnReply) Then
strSQL = "SELECT timescfg.* From timescfg;"
rsConn.Open strSQL, adoCon
If NOT rsConn.EOF Then
strUploadComponent = rsConn("upcomponent")
strFileUploadPath = rsConn("upfilepath")
saryFileUploadTypes = Split(Trim(rsConn("upfiletype")), ";")
strFileTypes = rsConn("upfiletype")
intMaxFileSize = CInt(rsConn("upfilesize"))
End If
End If
If Request.QueryString("PB") = "Y" Then
strFileName = fileUpload(strFileUploadPath, saryFileUploadTypes, intMaxFileSize, strUploadComponent, lngErrorFileSize, blnExtensionOK)
End If
Set rsConn = Nothing
adoCon.Close
Set adoCon = Nothing
%>
<html>
<head>
<title>文件上传</title>
<%
If lngErrorFileSize = 0 AND blnExtensionOK = True AND strFileName <> "" Then
If strMessageBoxType = "ADV" Then
%>
<script language="JavaScript">
window.opener.frames.message.focus();
var htmlLink = window.opener.frames.message.document.selection.createRange()
htmlLink.pasteHTML('<a href="<% = strFileUploadPath & "/" & strFileName %>"><% = strFileName %></a>');
window.opener.frames.message.document.execCommand('paste', false, '');
window.close();
</script><%
ElseIf strMessageBoxType = "BSC" Then
%>
<script language="JavaScript">
window.opener.document.frmAddMessage.message.focus();
window.opener.document.frmAddMessage.message.value += "[FILE=<% = strFileUploadPath & "/" & strFileName %>]<% = strFileName %>[/FILE]";
window.close();
</script><%
End If
End If
%>
<script language="JavaScript">
function CheckForm () {
var errorMsg = "";
if (document.frmUpload.file.value==""){
errorMsg += "\n\t选择文件错误";
}
if (errorMsg != ""){
msg = "_______________________________________________________________\n\n";
msg += "表单不完整,请填写完全\n";
msg += "请修正后再发表\n";
msg += "_______________________________________________________________\n\n";
msg += "以下区域需要修改: \n";
errorMsg += alert(msg + errorMsg + "\n\n");
return false;
}else{
alert("文件即将上传,单击确定后请等待!")
}
return true;
}
</script>
<!--#include file="includes/skin.asp" -->
</head>
<body bgcolor="<% = strBgColour %>" text="<% = strTextColour %>" background="<% = strBgImage %>" marginheight="0" marginwidth="2" topmargin="0" leftmargin="0" OnLoad="self.focus();">
<p> </p><table width="96%" border="0" cellspacing="0" cellpadding="1" align="center">
<tr>
<td align="center"><span class="heading">文件上传</span></td>
</tr>
</table>
<br /><%
If blnAttachments AND blnRead AND (blnPost OR blnReply) Then
If blnExtensionOK = False Then %>
<div align="center" class="text">文件格式错误<br />文件格式必须是: <%= Replace(strFileTypes, ";", ", ", 1, -1, 1) %></div><br />
<% ElseIf lngErrorFileSize <> 0 Then %>
<div align="center" class="text">文件太大<%= lngErrorFileSize %>KB.<br />上传文件最大值为: <%= intMaxFileSize %>KB</div><br />
<% End If %>
<table width="350" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="<% = strTableBorderColour %>">
<tr> <td>
<table border="0" align="center" cellpadding="4" cellspacing="1" width="350">
<tr align="left" bgcolor="<% = strTableColour %>" background="<% = strTableBgImage %>">
<td colspan="2" class="text" align="center">
<table width="340" border="0" cellspacing="0" cellpadding="4">
<form action="upfile.asp?MSG=<% = strMessageBoxType %>&fid=<% = intForumID %>&PB=Y" method="post" enctype="multipart/form-data" name="frmUpload" target="_self" id="frmUpload" onSubmit="return CheckForm();">
<tr>
<td align="center" class="text">选择你想上传的文件.
<br /><br />
<input name="file" type="file" size="<% If BrowserType() = "Netscape 4" Then Response.Write("20") Else Response.Write("35") %>" />
<br /><br />
<input type="submit" name="Submit" value="上传" /> <br /><br />
<span class="smText">文件格式必须是: <%= Replace(strFileTypes, ";", ", ", 1, -1, 1) %>,文件最大值: <%= intMaxFileSize %>KB</span>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table></td>
</tr>
</table><%
End If
%>
<table width="96%" border="0" cellspacing="0" cellpadding="1" align="center">
<tr>
<td align="center" height="34"><a href="JavaScript:onClick=window.close()">关闭窗口</a></td>
</tr>
</table>
<br/><br/>
<!-- #include file="includes/footer.asp" -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -