~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/FCK/editor/filemanager/upload/asp/upload.asp

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<%@ CodePage=65001 Language="VBScript"%>
 
2
<%
 
3
Option Explicit
 
4
Response.Buffer = True
 
5
%>
 
6
<!--
 
7
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 
8
 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
 
9
 *
 
10
 * == BEGIN LICENSE ==
 
11
 *
 
12
 * Licensed under the terms of any of the following licenses at your
 
13
 * choice:
 
14
 *
 
15
 *  - GNU General Public License Version 2 or later (the "GPL")
 
16
 *    http://www.gnu.org/licenses/gpl.html
 
17
 *
 
18
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 
19
 *    http://www.gnu.org/licenses/lgpl.html
 
20
 *
 
21
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 
22
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 
23
 *
 
24
 * == END LICENSE ==
 
25
 *
 
26
 * This is the "File Uploader" for ASP.
 
27
-->
 
28
<!--#include file="config.asp"-->
 
29
<!--#include file="io.asp"-->
 
30
<!--#include file="class_upload.asp"-->
 
31
<%
 
32
 
 
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>"
 
38
        Response.End
 
39
End Function
 
40
 
 
41
%>
 
42
<%
 
43
 
 
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"
 
47
End If
 
48
 
 
49
' The the file type (from the QueryString, by default 'File').
 
50
Dim resourceType
 
51
If ( Request.QueryString("Type") <> "" ) Then
 
52
        resourceType = Request.QueryString("Type")
 
53
Else
 
54
        resourceType = "File"
 
55
End If
 
56
 
 
57
' Create the Uploader object.
 
58
Dim oUploader
 
59
Set oUploader = New NetRube_Upload
 
60
oUploader.MaxSize       = 0
 
61
oUploader.Allowed       = ConfigAllowedExtensions.Item( resourceType )
 
62
oUploader.Denied        = ConfigDeniedExtensions.Item( resourceType )
 
63
oUploader.GetData
 
64
 
 
65
If oUploader.ErrNum > 1 Then
 
66
        SendResults "202", "", "", ""
 
67
Else
 
68
        Dim sFileName, sFileUrl, sErrorNumber, sOriginalFileName, sExtension
 
69
        sFileName               = ""
 
70
        sFileUrl                = ""
 
71
        sErrorNumber    = "0"
 
72
 
 
73
        ' Map the virtual path to the local server path.
 
74
        Dim sServerDir
 
75
        sServerDir = Server.MapPath( ConfigUserFilesPath )
 
76
        If ( Right( sServerDir, 1 ) <> "\" ) Then
 
77
                sServerDir = sServerDir & "\"
 
78
        End If
 
79
 
 
80
        If ( ConfigUseFileType = True ) Then
 
81
                sServerDir = sServerDir & resourceType & "\"
 
82
        End If
 
83
 
 
84
        Dim oFSO
 
85
        Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
 
86
 
 
87
        ' Get the uploaded file name.
 
88
        sFileName       = oUploader.File( "NewFile" ).Name
 
89
        sExtension      = oUploader.File( "NewFile" ).Ext
 
90
        sOriginalFileName = sFileName
 
91
 
 
92
        Dim iCounter
 
93
        iCounter = 0
 
94
 
 
95
        Do While ( True )
 
96
                Dim sFilePath
 
97
                sFilePath = sServerDir & sFileName
 
98
 
 
99
                If ( oFSO.FileExists( sFilePath ) ) Then
 
100
                        iCounter = iCounter + 1
 
101
                        sFileName = RemoveExtension( sOriginalFileName ) & "(" & iCounter & ")." & sExtension
 
102
                        sErrorNumber = "201"
 
103
                Else
 
104
                        oUploader.SaveAs "NewFile", sFilePath
 
105
                        If oUploader.ErrNum > 0 Then SendResults "202", "", "", ""
 
106
                        Exit Do
 
107
                End If
 
108
        Loop
 
109
 
 
110
        If ( ConfigUseFileType = True ) Then
 
111
                sFileUrl = ConfigUserFilesPath & resourceType & "/" & sFileName
 
112
        Else
 
113
                sFileUrl = ConfigUserFilesPath & sFileName
 
114
        End If
 
115
 
 
116
        SendResults sErrorNumber, sFileUrl, sFileName, ""
 
117
 
 
118
End If
 
119
 
 
120
Set oUploader = Nothing
 
121
%>
 
 
b'\\ No newline at end of file'