📄 upfilesave.asp
字号:
<% Option Explicit %>
<!--#include file="../Conn.asp"-->
<!--#include file="../SysCls/KS_Thumbs.asp"-->
<!--#include file="../SysCls/KS_UserCommonCls.asp"-->
<!--#include file="Upfile.asp" -->
<%
'===================================================================================================================
'软件名称:科汛网站管理系统
'当前版本:科汛网站管理系统2006 SP1无组件精装版(Access)版本
'最后更新:2006年4月2日
'Copyright (C) 2006-2008 Kesion.Com All rights reserved.
'产品咨询QQ:9537636,41904294,504438432
'技术支持QQ:111394,54004407
'程序版权:科汛网络
'程序策划:林文仲
'程序开发:科汛开发组
'E-Mail : kesioncms@hotmail.com webmaster@kesion.com
'官方网站:http://www.kesion.com
'演示站点:http://test.kesion.com
'郑重声明:
' ①、免费版本请在程序首页保留版权信息,并做上本站LOGO友情连接,商业版本无此要求;
' ②、任何个人或组织不得删除、修改、拷贝本软件及其他副本上一切关于版权的信息;
' ③、科汛网络保留此软件的法律追究权利
'===================================================================================================================
Dim KSCls
Set KSCls = New UpFileSave
KSCls.Execute()
Set KSCls = Nothing
Class UpFileSave
Private KSCMS,KSUser
Dim FilePath,MaxFileSize,AllowFileExtStr,AutoReName,RsConfigObj
Dim FormName,Path,UpLoadFrom,TempFileStr,FormPath,ThumbFileName,ThumbPathFileName
Dim UpFileObj,FsoObjName,AddWaterFlag,T,CurrNum,CreateThumbsFlag
Dim DefaultThumb '设定第几张为缩略图
Dim ReturnValue
Private Sub Class_Initialize()
Set T=New Thumb
Set KSCMS=New CommonCls
Set KSUser = New UserCls
End Sub
Private Sub Class_Terminate()
Call KSCMS.CloseConn()
Set T=Nothing
Set KSCMS=Nothing
Set KSUser=Nothing
End Sub
Sub Execute()
IF Cbool(KSUser.UserLoginChecked)=false Then
Response.Write "<script>top.location.href='Login.asp';</script>"
Exit Sub
End If
Response.Write("<style type='text/css'>" & vbcrlf)
Response.Write("<!--" & vbcrlf)
Response.Write("body {" & vbcrlf)
Response.Write(" margin-left: 0px;" & vbcrlf)
Response.Write(" margin-top: 0px;" & vbcrlf)
Response.Write(" font-size: 12px;" & vbcrlf)
Response.Write(" background:#f9f9f9;" & vbcrlf)
Response.Write("}" & vbcrlf)
Response.Write("-->" & vbcrlf)
Response.Write("</style>" & vbcrlf)
FsoObjName=KSCMS.GetConfig("FsoObjName")
Set UpFileObj = New UpFileClass
UpFileObj.GetData
FormPath=UpFileObj.Form("Path")
IF Instr(FormPath,KSCMS.GetConfig("InstallDir"))=0 Then
FormPath=KSCMS.GetConfig("InstallDir") & FormPath
End IF
FilePath=Server.MapPath(FormPath) & "\"
'Response.Write FormPath
'Response.End
AutoReName = UpFileObj.Form("AutoRename")
UpLoadFrom=UpFileObj.Form("UpLoadFrom") '0--通用对话框 2-- 图片中心上传 31--下载中心缩略图 32--下载中心文件 41--Flash中心缩略图 42--Flash中心的Flash文件
IF UpLoadFrom="" then
UpLoadFrom=0
End IF
CurrNum=0
CreateThumbsFlag=false
DefaultThumb=UpFileObj.Form("DefaultUrl")
if DefaultThumb="" then DefaultThumb=0
AddWaterFlag = UpFileObj.Form("AddWaterFlag")
If AddWaterFlag <> "1" Then '生成是否要添加水印标记
AddWaterFlag = "0"
End if
'设置文件上传限制,类型及大小
Select Case UpLoadFrom
Case 0 '默认上传参数
MaxFileSize = KSCMS.ReturnChannelAllowUpFilesSize(0) '设定文件上传最大字节数
AllowFileExtStr = KSCMS.ReturnChannelAllowUpFilesType(0,0)
Case 1 '文章中心
CreateThumbsFlag=true
MaxFileSize = KSCMS.ReturnChannelAllowUpFilesSize(1) '设定文件上传最大字节数
AllowFileExtStr = KSCMS.ReturnChannelAllowUpFilesType(1,0)
Case 11 '文章中心缩略图
if Not KSCMS.ReturnChannelAllowUserUpFilesTF(1) Then
Response.Write "<br><div align=center>对不起,系统不允许此频道上传文件,请与网站管理员联系!</div>"
Exit Sub
End IF
CreateThumbsFlag=true
MaxFileSize = KSCMS.ReturnChannelAllowUpFilesSize(1) '设定文件上传最大字节数
AllowFileExtStr = KSCMS.ReturnChannelAllowUpFilesType(1,1)
Case 2 '图片中心
CreateThumbsFlag=true
MaxFileSize = KSCMS.ReturnChannelAllowUpFilesSize(2) '设定文件上传最大字节数
AllowFileExtStr = KSCMS.ReturnChannelAllowUpFilesType(2,0)
Case 21 '图片中心上传图片
if Not KSCMS.ReturnChannelAllowUserUpFilesTF(2) Then
Response.Write "<br><div align=center>对不起,系统不允许此频道上传文件,请与网站管理员联系!</div>"
Exit Sub
End IF
CreateThumbsFlag=true
MaxFileSize = KSCMS.ReturnChannelAllowUpFilesSize(2) '设定文件上传最大字节数
AllowFileExtStr = KSCMS.ReturnChannelAllowUpFilesType(2,1)
Case 31 '下载中心缩略图
If Not KSCMS.ReturnChannelAllowUserUpFilesTF(3) Then
Response.Write "<br><div align=center>对不起,系统不允许此频道上传文件,请与网站管理员联系!</div>"
Exit Sub
End IF
CreateThumbsFlag=true
MaxFileSize = KSCMS.ReturnChannelAllowUpFilesSize(3) '设定文件上传最大字节数
AllowFileExtStr = KSCMS.ReturnChannelAllowUpFilesType(3,1)
Case 32,3 '下载中心文件
If Not KSCMS.ReturnChannelAllowUserUpFilesTF(3) Then
Response.Write "<br><div align=center>对不起,系统不允许此频道上传文件,请与网站管理员联系!</div>"
Exit Sub
End IF
MaxFileSize = KSCMS.ReturnChannelAllowUpFilesSize(3) '设定文件上传最大字节数
AllowFileExtStr = KSCMS.ReturnChannelAllowUpFilesType(3,0)
Case 41 'Flash中心缩略图
If Not KSCMS.ReturnChannelAllowUserUpFilesTF(4) Then
Response.Write "<br><div align=center>对不起,系统不允许此频道上传文件,请与网站管理员联系!</div>"
Exit Sub
End IF
CreateThumbsFlag=true
MaxFileSize = KSCMS.ReturnChannelAllowUpFilesSize(4) '设定文件上传最大字节数
AllowFileExtStr = KSCMS.ReturnChannelAllowUpFilesType(4,1)
Case 42 'Flash文件
If Not KSCMS.ReturnChannelAllowUserUpFilesTF(4) Then
Response.Write "<br><div align=center>对不起,系统不允许此频道上传文件,请与网站管理员联系!</div>"
Exit Sub
End IF
MaxFileSize = KSCMS.ReturnChannelAllowUpFilesSize(4) '设定文件上传最大字节数
AllowFileExtStr = KSCMS.ReturnChannelAllowUpFilesType(4,2) '取允许上传的Flash类型
Case 4 'Flash简介上传
MaxFileSize = KSCMS.ReturnChannelAllowUpFilesSize(4) '设定文件上传最大字节数
AllowFileExtStr = KSCMS.ReturnChannelAllowUpFilesType(4,0)
End Select
Call KSCMS.CreateListFolder(FormPath) '生成上传文件存放目录
ReturnValue = CheckUpFile(FilePath,MaxFileSize,AllowFileExtStr,AutoReName)
Select Case UpLoadFrom
Case 11 '文章中心的上传缩略图
if ReturnValue <> "" then
Response.Write("<script language=""JavaScript"">")
Response.Write("alert('" & ReturnValue & "');")
Response.Write("history.back(-1);")
Response.Write("</script>")
else
Response.Write("<script language=""JavaScript"">")
if DefaultThumb=0 then
Response.Write("parent.document.all.PicUrl.value='" & replace(TempFileStr,"|","") & "';")
else
If KSCMS.CheckFile(ThumbPathFileName)=true Then '检查是否存在缩略图
Response.Write("parent.document.all.PicUrl.value='" & ThumbPathFileName & "';")
'Call KSCMS.DeleteFile(replace(TempFileStr,"|","")) '删除原图片
Else
Response.Write("parent.document.all.PicUrl.value='" & replace(TempFileStr,"|","") & "';")
End If
Response.Write("parent.ArticleContent.InsertPictureFromUp('" & replace(TempFileStr,"|","") &"');")
end if
Response.Write("document.write(' <font size=2>图片上传成功!</font>');")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -