source: companies/celepar/expressoMail1_2/js/fckeditor/editor/filemanager/upload/asp/upload.asp @ 763

Revision 763, 3.3 KB checked in by niltonneto, 15 years ago (diff)

Importação inicial do Expresso da Celepar

Line 
1<%@ CodePage=65001 Language="VBScript"%>
2<%
3Option Explicit
4Response.Buffer = True
5%>
6<!--
7 * FCKeditor - The text editor for internet
8 * Copyright (C) 2003-2006 Frederico Caldeira Knabben
9 *
10 * Licensed under the terms of the GNU Lesser General Public License:
11 *              http://www.opensource.org/licenses/lgpl-license.php
12 *
13 * For further information visit:
14 *              http://www.fckeditor.net/
15 *
16 * "Support Open Source software. What about a donation today?"
17 *
18 * File Name: upload.asp
19 *      This is the "File Uploader" for ASP.
20 *
21 * File Authors:
22 *              Frederico Caldeira Knabben (fredck@fckeditor.net)
23-->
24<!--#include file="config.asp"-->
25<!--#include file="io.asp"-->
26<!--#include file="class_upload.asp"-->
27<%
28
29' This is the function that sends the results of the uploading process.
30Function SendResults( errorNumber, fileUrl, fileName, customMsg )
31        Response.Write "<script type=""text/javascript"">"
32        Response.Write "window.parent.OnUploadCompleted(" & errorNumber & ",""" & Replace( fileUrl, """", "\""" ) & """,""" & Replace( fileName, """", "\""" ) & """,""" & Replace( customMsg , """", "\""" ) & """) ;"
33        Response.Write "</script>"
34        Response.End
35End Function
36
37%>
38<%
39
40' Check if this uploader has been enabled.
41If ( ConfigIsEnabled = False ) Then
42        SendResults "1", "", "", "This file uploader is disabled. Please check the ""editor/filemanager/upload/asp/config.asp"" file"
43End If
44
45' The the file type (from the QueryString, by default 'File').
46Dim resourceType
47If ( Request.QueryString("Type") <> "" ) Then
48        resourceType = Request.QueryString("Type")
49Else
50        resourceType = "File"
51End If
52
53' Create the Uploader object.
54Dim oUploader
55Set oUploader = New NetRube_Upload
56oUploader.MaxSize       = 0
57oUploader.Allowed       = ConfigAllowedExtensions.Item( resourceType )
58oUploader.Denied        = ConfigDeniedExtensions.Item( resourceType )
59oUploader.GetData
60
61If oUploader.ErrNum > 1 Then
62        SendResults "202", "", "", ""
63Else
64        Dim sFileName, sFileUrl, sErrorNumber, sOriginalFileName, sExtension
65        sFileName               = ""
66        sFileUrl                = ""
67        sErrorNumber    = "0"
68
69        ' Map the virtual path to the local server path.
70        Dim sServerDir
71        sServerDir = Server.MapPath( ConfigUserFilesPath )
72        If ( Right( sServerDir, 1 ) <> "\" ) Then
73                sServerDir = sServerDir & "\"
74        End If
75       
76        If ( ConfigUseFileType = True ) Then
77                sServerDir = sServerDir & resourceType & "\"
78        End If
79
80        Dim oFSO
81        Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
82
83        ' Get the uploaded file name.
84        sFileName       = oUploader.File( "NewFile" ).Name
85        sExtension      = oUploader.File( "NewFile" ).Ext
86        sOriginalFileName = sFileName
87
88        Dim iCounter
89        iCounter = 0
90
91        Do While ( True )
92                Dim sFilePath
93                sFilePath = sServerDir & sFileName
94
95                If ( oFSO.FileExists( sFilePath ) ) Then
96                        iCounter = iCounter + 1
97                        sFileName = RemoveExtension( sOriginalFileName ) & "(" & iCounter & ")." & sExtension
98                        sErrorNumber = "201"
99                Else
100                        oUploader.SaveAs "NewFile", sFilePath
101                        If oUploader.ErrNum > 0 Then SendResults "202", "", "", ""
102                        Exit Do
103                End If
104        Loop
105
106        If ( ConfigUseFileType = True ) Then
107                sFileUrl = ConfigUserFilesPath & resourceType & "/" & sFileName
108        Else
109                sFileUrl = ConfigUserFilesPath & sFileName
110        End If
111
112        SendResults sErrorNumber, sFileUrl, sFileName, ""
113       
114End If
115
116Set oUploader = Nothing
117%>
Note: See TracBrowser for help on using the repository browser.