📄 saveupfile.aspx.vb
字号:
' ***************************************************
' * 本程序由AspToAspX风火轮0.99转换生成 *
' * http://Www.AspToAspX.Cn *
' * Q Q : 139227536 *
' * QQ群: 17152722 *
' * MSN : gzliangjianhua@hotmail.com *
' * EMail AspToDll@vip.163.com *
' ***************************************************
Imports Microsoft.VisualBasic
Imports System.Web
Imports System.Math
Imports System.Web.SessionState
Public Class _SAVEUPFILE
Inherits System.Web.UI.Page
Implements IHttpHandler, AspToAspX_Interface
Public AspToAspX_Host_Class_Object As Object
Public upload,file,upfile,formPath,ServerPath,FSPath,formName,companyName,oFile,upfilecount,SaveFileName,SavePathFileName
Public url
Public upfiletype
Public upfilesize
Public uploadvalue
Public cookiesname
Public clubuser_id
Public topqs
Public htmfilename
Public inFolder
Public myFolder
Public fileStreamObj
Public FilePath
Public filesize
Public sale
Public vfname
Public Random
Public FileExt
Public filetype
Public fname
Public todbpath
Public sql
Public rs As ADODB.Recordset
Public id
Public linkdb
Public ft
Public ku
Public ckiesdomain
Public conndb
Public ConnectionString
Public ASPX_CONN As _CONN
Public ASPX_INC_UBBCODE As _INC_UBBCODE
Public ASPX_UPFILE_CLASS As _UPFILE_CLASS
Public ASPX_TOUXIANFUN As _TOUXIANFUN
Public ASPX_ISPICFUN As _ISPICFUN
#Region "..."
Public Sub AspToAspX_InitIncludeFiles()
ASPX_CONN = New _CONN()
ASPX_CONN.AspToAspX_Host_Class_Object = AspToAspX_Host_Class_Object
ASPX_CONN.AspToAspX_InitIncludeFiles()
ASPX_INC_UBBCODE = New _INC_UBBCODE()
ASPX_INC_UBBCODE.AspToAspX_Host_Class_Object = AspToAspX_Host_Class_Object
ASPX_INC_UBBCODE.AspToAspX_InitIncludeFiles()
ASPX_UPFILE_CLASS = New _UPFILE_CLASS()
ASPX_UPFILE_CLASS.AspToAspX_Host_Class_Object = AspToAspX_Host_Class_Object
ASPX_UPFILE_CLASS.AspToAspX_InitIncludeFiles()
ASPX_TOUXIANFUN = New _TOUXIANFUN()
ASPX_TOUXIANFUN.AspToAspX_Host_Class_Object = AspToAspX_Host_Class_Object
ASPX_TOUXIANFUN.AspToAspX_InitIncludeFiles()
ASPX_ISPICFUN = New _ISPICFUN()
ASPX_ISPICFUN.AspToAspX_Host_Class_Object = AspToAspX_Host_Class_Object
ASPX_ISPICFUN.AspToAspX_InitIncludeFiles()
End Sub
Public Sub AspToAspX_UnloadIncludeFiles()
ASPX_CONN.AspToAspX_UnloadIncludeFiles()
ASPX_CONN = Nothing
ASPX_INC_UBBCODE.AspToAspX_UnloadIncludeFiles()
ASPX_INC_UBBCODE = Nothing
ASPX_UPFILE_CLASS.AspToAspX_UnloadIncludeFiles()
ASPX_UPFILE_CLASS = Nothing
ASPX_TOUXIANFUN.AspToAspX_UnloadIncludeFiles()
ASPX_TOUXIANFUN = Nothing
ASPX_ISPICFUN.AspToAspX_UnloadIncludeFiles()
ASPX_ISPICFUN = Nothing
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
AspToAspXGlobal.Application = Application
AspToAspXGlobal.Server = Server
AspToAspXGlobal.Response = Response
AspToAspXGlobal.Request = Request
AspToAspXGlobal.Session = Session
AspToAspX_Host_Class_Object = Me
AspToAspX_InitIncludeFiles()
AspToAspX_Page_Init()
End Sub
Public Sub AspToAspX_Page_Init()
On Error GoTo _AspToAspX_Err
ASPX_CONN.AspToAspX_Page_Init ( )
ASPX_INC_UBBCODE.AspToAspX_Page_Init ( )
ASPX_UPFILE_CLASS.AspToAspX_Page_Init ( )
ASPX_TOUXIANFUN.AspToAspX_Page_Init ( )
ASPX_ISPICFUN.AspToAspX_Page_Init ( )
Server.ScriptTimeout = 10000 '7
FTBBS_HTML_MB ( ft ) '8
url = Application ( "FTBBSMB" ) ( 10 , 0 ) '9
upfiletype = Application ( "FTBBSMB" ) ( 12 , 0 ) '10
upfilesize = Application ( "FTBBSMB" ) ( 13 , 0 ) '11
uploadvalue = Application ( "FTBBSMB" ) ( 60 , 0 ) '12
cookiesname = getcookie ( "name" ) '13
clubuser_id = AspToAspX_CInt ( getcookie ( "clubuser_id" ) ) '14
upfiletype = RegExReplace ( upfiletype , "(asp)" , "rar" ) '15
upfiletype = RegExReplace ( upfiletype , "(asa)" , "rar" ) '16
upfiletype = RegExReplace ( upfiletype , "(cdx)" , "rar" ) '17
upfiletype = RegExReplace ( upfiletype , "(cer)" , "rar" ) '18
If AspToAspX_CheckDBNull ( uploadvalue ) = 0 Then '19
topqs = 1 '20
Else '21
topqs = jingyuantoqs ( clubuser_id , uploadvalue , ft ) '22
End If '23
If AspToAspX_CheckDBNull ( right ( url , 1 ) ) < > "/" Then
url = url & "/"
End If
'24
Response.Write ( vbCrLf )
Response.Write ( "<html><title>保存上传(飞天论坛)</title>" & Chr ( 13 ) ) '27
Response.Write ( "<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"">" & Chr ( 13 ) ) '28
Response.Write ( "<script language=javascript src=""inc/cookies.js""></script>" & Chr ( 13 ) ) '29
Response.Write ( "<script>" & Chr ( 13 ) ) '30
Response.Write ( "var stylecook = getCookie(""STYLESHOW"");" & Chr ( 13 ) ) '31
Response.Write ( "var style;" & Chr ( 13 ) ) '32
Response.Write ( "var strstyle;" & Chr ( 13 ) ) '33
Response.Write ( "if(stylecook=="""")" & Chr ( 13 ) ) '34
Response.Write ( "{" & Chr ( 13 ) ) '35
Response.Write ( " stylecook=1;" & Chr ( 13 ) ) '36
Response.Write ( "}" & Chr ( 13 ) ) '37
Response.Write ( "else" & Chr ( 13 ) ) '38
Response.Write ( "{" & Chr ( 13 ) ) '39
Response.Write ( " stylecook++;" & Chr ( 13 ) ) '40
Response.Write ( "}" & Chr ( 13 ) ) '41
Response.Write ( "style=""main0""+stylecook+"".css"";" & Chr ( 13 ) ) '42
Response.Write ( "strstyle=""<link href=\""css/""+style+""\"" rel=\""stylesheet\"" type=\""text/css\""> "";" & Chr ( 13 ) ) '43
Response.Write ( "document.write(strstyle);" & Chr ( 13 ) ) '44
Response.Write ( "</script>" & Chr ( 13 ) ) '45
Response.Write ( "<script type=""text/javascript"" src=""fteditor/iframe.js""></script>" & Chr ( 13 ) ) '46
Response.Write ( "<script language=""javascript"">" & Chr ( 13 ) ) '47
Response.Write ( "function insertnl(filetype,imgsrc,id,url,fn,sale) {" & Chr ( 13 ) ) '48
Response.Write ( "" & Chr ( 9 ) & "filetype=filetype.toLowerCase( );" & Chr ( 13 ) ) '49
Response.Write ( " if (filetype=='gif'||filetype=='jpg'||filetype=='png'||filetype=='bmp'||filetype=='jpeg'){" & Chr ( 13 ) ) '50
Response.Write ( "" & Chr ( 9 ) & " parent.document.getElementById(""bbs_img_display"").value=1;" & Chr ( 13 ) ) '51
Response.Write ( " nl='[IMG]'+imgsrc+'[/IMG]';" & Chr ( 13 ) ) '52
Response.Write ( "" & Chr ( 9 ) & "}else if(filetype=='swf'){" & Chr ( 13 ) ) '53
Response.Write ( "" & Chr ( 9 ) & " parent.document.getElementById(""bbs_img_display"").value=2;" & Chr ( 13 ) ) '54
Response.Write ( "" & Chr ( 9 ) & " nl='[flash=400,300]'+imgsrc+'[/flash]';" & Chr ( 13 ) ) '55
Response.Write ( "" & Chr ( 9 ) & "}else if(filetype=='flv'){" & Chr ( 13 ) ) '56
Response.Write ( "" & Chr ( 9 ) & " parent.document.getElementById(""bbs_img_display"").value=4;" & Chr ( 13 ) ) '57
Response.Write ( "" & Chr ( 9 ) & " nl='[flv=500,400,false]'+imgsrc+'[/flv]';" & Chr ( 13 ) ) '58
Response.Write ( "" & Chr ( 9 ) & "}else{" & Chr ( 13 ) ) '59
Response.Write ( "" & Chr ( 9 ) & " parent.document.getElementById(""bbs_img_display"").value=3;" & Chr ( 13 ) ) '60
Response.Write ( "" & Chr ( 9 ) & " if (sale>0){" & Chr ( 13 ) ) '61
Response.Write ( "" & Chr ( 9 ) & " nl='[img]../images/file.gif[/img][b]附件[/b](下载需扣'+sale+'积分):[url=../down.aspx?id='+id+']'+fn+'[/url]';" & Chr ( 13 ) ) '62
Response.Write ( "" & Chr ( 9 ) & " }else{" & Chr ( 13 ) ) '63
Response.Write ( "" & Chr ( 9 ) & " nl='[img]../images/file.gif[/img][b]附件:[/b][url=../down.aspx?id='+id+']'+fn+'[/url]';" & Chr ( 13 ) ) '64
Response.Write ( "" & Chr ( 9 ) & " }" & Chr ( 13 ) ) '65
Response.Write ( "" & Chr ( 9 ) & "}" & Chr ( 13 ) ) '66
Response.Write ( "" & Chr ( 9 ) & "parent.document.getElementById(""bbs_img"").value=filetype;" & Chr ( 13 ) ) '67
Response.Write ( "" & Chr ( 9 ) & "parent.document.getElementById(""sale"").value=sale;" & Chr ( 13 ) ) '68
Response.Write ( "" & Chr ( 9 ) & "var CurrentMode=parent.document.getElementById(""CurrentMode"").value;" & Chr ( 13 ) ) '69
Response.Write ( "" & Chr ( 9 ) & "if (CurrentMode=='code'){" & Chr ( 13 ) ) '70
Response.Write ( "" & Chr ( 9 ) & "alert('代码模式下不允许插入附件');" & Chr ( 13 ) ) '71
Response.Write ( "" & Chr ( 9 ) & "return false;" & Chr ( 13 ) ) '72
Response.Write ( "" & Chr ( 9 ) & "}else{" & Chr ( 13 ) ) '73
Response.Write ( "" & Chr ( 9 ) & "var element = parent.document.createElement(""span"");" & Chr ( 13 ) ) '74
Response.Write ( "" & Chr ( 9 ) & "element.appendChild(parent.document.createTextNode(nl));" & Chr ( 13 ) ) '75
Response.Write ( "" & Chr ( 9 ) & "FtSelection();" & Chr ( 13 ) ) '76
Response.Write ( "" & Chr ( 9 ) & "FtInsertItem(element);" & Chr ( 13 ) ) '77
Response.Write ( "" & Chr ( 9 ) & "}" & Chr ( 13 ) ) '78
Response.Write ( "}" & Chr ( 13 ) ) '79
Response.Write ( "</script>" & Chr ( 13 ) ) '80
Response.Write ( "<body topmargin=""0"" class=""maintbtr3"">" & Chr ( 13 ) ) '81
If AspToAspX_CheckDBNull ( userlogin ( ft ) ) = "N" Then '83
Response.Write ( "<font color=red>你还没有登录</font>" ) '84
Response.End ( ) '85
End If '86
If AspToAspX_CheckDBNull ( topqs ) = 0 Then '87
Response.Write ( "<font color=red>你的积分太低无法上传附件</font>" ) '88
Response.End ( ) '89
End If '90
htmfilename = Session ( "filename" ) '91
If AspToAspX_CheckDBNull ( htmfilename ) = EmptyString.Value Then '92
Response.Write ( "<font color=red>超时请返回重新发布</font>" ) '93
Response.End ( ) '94
End If '95
If AspToAspX_CheckDBNull ( InStr ( htmfilename , "/" ) ) > 0 Then '96
inFolder = AspToAspX_Split ( htmfilename , "/" ) ( 0 ) '97
inFolder = replace ( inFolder , "." , "" ) '98
htmfilename = AspToAspX_Split ( htmfilename , "/" ) ( 1 ) '99
Else '100
If AspToAspX_CheckDBNull ( Application ( "FTBBSMB" ) ( 7 , 0 ) ) = "M" Then '101
inFolder = Year ( ToDay ( ) ) & Month ( ToDay ( ) ) '102
Else '103
inFolder = Year ( ToDay ( ) ) & Month ( ToDay ( ) ) & Day ( ToDay ( ) ) '104
End If '105
End If '106
myFolder = inFolder '107
myFolder = Server.MapPath ( myFolder ) '108
fileStreamObj = New Scripting.FileSystemObject ( ) '109
If AspToAspX_CheckDBNull ( fileStreamObj.FolderExists ( myFolder ) ) = False Then '110
fileStreamObj.CreateFolder ( myFolder ) '111
End If '112
upload = New Ftbbs_Class ( AspToAspX_Host_Class_Object ) '114
upload.AllowExt = upfiletype '115
upload.GetData ( upfilesize ) '116
formPath = inFolder '117
FilePath = inFolder & "/" '118
If AspToAspX_CheckDBNull ( right ( formPath , 1 ) ) < > "/" Then
formPath = formPath & "/"
End If
'119
If upload.isErr Then '120
Select Case upload.isErr '121
Case 1 '122
Response.Write ( "<font color=red>上传文件不能为空</font>" ) '123
Response.Write ( " <a href=FtbbsUpFile.aspx?filename=" & htmfilename & ">重新上传</a>" ) '124
Case 2 '125
Response.Write ( "系统限制上传文件大小在<font color=red>" & upfilesize & "</font>字节以下 <a href=FtbbsUpFile.aspx?filename=" & htmfilename & ">重新上传</a>" ) '126
End Select '127
Else '128
For Each formName In upload.file '129
oFile = upload.file ( formname ) '130
filesize = oFile.FileSize '131
sale = upload.Form ( "sale" ) '132
vfname = makefilename ( DateAndTime.Now ) '133
Randomize ( ) '134
Random = AspToAspX_Int ( ( 1000 - 100 + 1 ) * AspToAspX_Rnd + 100 ) '135
vfname = vfname & "_" & Random '136
FileExt = oFile.FileExt '137
filetype = oFile.FileMIME '138
If AspToAspX_CheckDBNull ( filetype ) = "text/plain" Then '139
Response.Write ( "您上传的文件有问题! <a href=FtbbsUpFile.aspx?filename=" & htmfilename & ">重新上传</a>" ) '140
Response.End ( ) '141
End If '142
fname = formPath & vfname & "." & FileExt '143
todbpath = vfname & "." & FileExt '144
SavePathFileName = Server.MapPath ( fname ) '145
upload.SaveToFile ( formName , SavePathFileName ) '146
If upload.iserr Then '147
Response.Write ( upload.errmessage ) '148
Else '149
If AspToAspX_CheckDBNull ( Application ( "FTBBSMB" ) ( 15 , 0 ) ) = 1 And AspToAspX_CheckDBNull ( FileExt ) = "jpg" Then '150
If AspToAspX_CheckDBNull ( Application ( "FTBBSMB" ) ( 36 , 0 ) ) = 1 Then '151
imgtologo ( fname ) '152
Else '153
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -