2
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
7
* Licensed under the terms of any of the following licenses at your
10
* - GNU General Public License Version 2 or later (the "GPL")
11
* http://www.gnu.org/licenses/gpl.html
13
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14
* http://www.gnu.org/licenses/lgpl.html
16
* - Mozilla Public License Version 1.1 or later (the "MPL")
17
* http://www.mozilla.org/MPL/MPL-1.1.html
21
* Test page for the "File Uploaders".
25
<title>FCKeditor - Uploaders Tests</title>
26
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
27
<script type="text/javascript">
29
// Automatically detect the correct document.domain (#1919).
32
var d = document.domain ;
36
// Test if we can access a parent property.
39
var test = window.opener.document.domain ;
44
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
45
d = d.replace( /.*?(?:\.|$)/, '' ) ;
48
break ; // It was not able to detect the domain.
63
var sUploaderUrl = cmbUploaderUrl.value ;
65
if ( sUploaderUrl.length == 0 )
66
sUploaderUrl = txtCustomUrl.value ;
68
if ( sUploaderUrl.length == 0 )
70
alert( 'Please provide your custom URL or select a default one' ) ;
74
eURL.innerHTML = sUploaderUrl ;
79
frmUpload.action = sUploaderUrl + '?time=' + date.getTime();
80
if (document.getElementById('cmbType').value) {
81
frmUpload.action = frmUpload.action + '&Type='+document.getElementById('cmbType').value;
83
if (document.getElementById('CurrentFolder').value) {
84
frmUpload.action = frmUpload.action + '&CurrentFolder='+document.getElementById('CurrentFolder').value;
89
function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
91
switch ( errorNumber )
94
txtUrl.value = fileUrl ;
95
alert( 'File uploaded with no errors' ) ;
97
case 1 : // Custom error
100
case 10 : // Custom warning
101
txtUrl.value = fileUrl ;
105
txtUrl.value = fileUrl ;
106
alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
109
alert( 'Invalid file' ) ;
112
alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ;
115
alert( 'Error on file upload. Error number: ' + errorNumber ) ;
123
<table cellSpacing="0" cellPadding="0" width="100%" border="0" height="100%">
126
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
129
Select the "File Uploader" to use: <br>
130
<select id="cmbUploaderUrl">
131
<option selected value="asp/upload.asp">ASP</option>
132
<option value="aspx/upload.aspx">ASP.Net</option>
133
<option value="cfm/upload.cfm">ColdFusion</option>
134
<option value="lasso/upload.lasso">Lasso</option>
135
<option value="perl/upload.cgi">Perl</option>
136
<option value="php/upload.php">PHP</option>
137
<option value="py/upload.py">Python</option>
138
<option value="">(Custom)</option>
143
<select id="cmbType" name="cmbType">
144
<option value="">None</option>
145
<option value="File">File</option>
146
<option value="Image">Image</option>
147
<option value="Flash">Flash</option>
148
<option value="Media">Media</option>
149
<option value="Invalid">Invalid Type (for testing)</option>
154
<input type="text" name="CurrentFolder" id="CurrentFolder" value="/">
156
<td nowrap> </td>
158
Custom Uploader URL:<BR>
159
<input id="txtCustomUrl" style="WIDTH: 100%; BACKGROUND-COLOR: #dcdcdc" disabled type="text">
164
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
167
<form id="frmUpload" target="UploadWindow" enctype="multipart/form-data" action="" method="post">
168
Upload a new file:<br>
169
<input type="file" name="NewFile"><br>
171
<input type="button" value="Send it to the Server" onclick="SendFile();">
174
<td style="WIDTH: 16px"> </td>
175
<td vAlign="top" width="100%">
176
Uploaded File URL:<br>
177
<INPUT id="txtUrl" style="WIDTH: 100%" readonly type="text">
182
Post URL: <span id="eURL"> </span>
187
<iframe name="UploadWindow" width="100%" height="100%" src="javascript:void(0)"></iframe>