1
<%@ CodePage=65001 Language="VBScript"%>
7
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
8
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
12
* Licensed under the terms of any of the following licenses at your
15
* - GNU General Public License Version 2 or later (the "GPL")
16
* http://www.gnu.org/licenses/gpl.html
18
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
19
* http://www.gnu.org/licenses/lgpl.html
21
* - Mozilla Public License Version 1.1 or later (the "MPL")
22
* http://www.mozilla.org/MPL/MPL-1.1.html
26
* This is the "File Uploader" for ASP.
28
<!--#include file="config.asp"-->
29
<!--#include file="io.asp"-->
30
<!--#include file="class_upload.asp"-->
33
' This is the function that sends the results of the uploading process.
34
Function SendResults( errorNumber, fileUrl, fileName, customMsg )
35
Response.Write "<script type=""text/javascript"">"
36
Response.Write "window.parent.OnUploadCompleted(" & errorNumber & ",""" & Replace( fileUrl, """", "\""" ) & """,""" & Replace( fileName, """", "\""" ) & """,""" & Replace( customMsg , """", "\""" ) & """) ;"
37
Response.Write "</script>"
44
' Check if this uploader has been enabled.
45
If ( ConfigIsEnabled = False ) Then
46
SendResults "1", "", "", "This file uploader is disabled. Please check the ""editor/filemanager/upload/asp/config.asp"" file"
49
' The the file type (from the QueryString, by default 'File').
51
If ( Request.QueryString("Type") <> "" ) Then
52
resourceType = Request.QueryString("Type")
57
' Create the Uploader object.
59
Set oUploader = New NetRube_Upload
61
oUploader.Allowed = ConfigAllowedExtensions.Item( resourceType )
62
oUploader.Denied = ConfigDeniedExtensions.Item( resourceType )
65
If oUploader.ErrNum > 1 Then
66
SendResults "202", "", "", ""
68
Dim sFileName, sFileUrl, sErrorNumber, sOriginalFileName, sExtension
73
' Map the virtual path to the local server path.
75
sServerDir = Server.MapPath( ConfigUserFilesPath )
76
If ( Right( sServerDir, 1 ) <> "\" ) Then
77
sServerDir = sServerDir & "\"
80
If ( ConfigUseFileType = True ) Then
81
sServerDir = sServerDir & resourceType & "\"
85
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
87
' Get the uploaded file name.
88
sFileName = oUploader.File( "NewFile" ).Name
89
sExtension = oUploader.File( "NewFile" ).Ext
90
sOriginalFileName = sFileName
97
sFilePath = sServerDir & sFileName
99
If ( oFSO.FileExists( sFilePath ) ) Then
100
iCounter = iCounter + 1
101
sFileName = RemoveExtension( sOriginalFileName ) & "(" & iCounter & ")." & sExtension
104
oUploader.SaveAs "NewFile", sFilePath
105
If oUploader.ErrNum > 0 Then SendResults "202", "", "", ""
110
If ( ConfigUseFileType = True ) Then
111
sFileUrl = ConfigUserFilesPath & resourceType & "/" & sFileName
113
sFileUrl = ConfigUserFilesPath & sFileName
116
SendResults sErrorNumber, sFileUrl, sFileName, ""
120
Set oUploader = Nothing
b'\\ No newline at end of file'