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

📄 upimage.asp

📁 电子商务网络购物系统
💻 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 strImageName

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 blnImageUpload 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("upimgpath")
		saryFileUploadTypes = Split(Trim(rsConn("upimgtype")), ";")
		strFileTypes = rsConn("upimgtype")
		intMaxFileSize = CInt(rsConn("upimgsize"))
	End If
End If
If Request.QueryString("PB") = "Y" Then
	strImageName = 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 strImageName <> "" Then
	If strMessageBoxType = "ADV" Then
	%>
<script  language="JavaScript">
	window.opener.frames.message.focus();
	window.opener.frames.message.document.execCommand('InsertImage', false, '<% = strFileUploadPath & "/" & strImageName %>');
	window.close();
</script><%
	ElseIf strMessageBoxType = "BSC" Then
		%>
<script  language="JavaScript">
	window.opener.document.frmAddMessage.message.focus();
	window.opener.document.frmAddMessage.message.value += "[IMG]<% = strFileUploadPath & "/" & strImageName %>[/IMG]";
	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>&nbsp;</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 blnImageUpload 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="upimage.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 + -