1 | <!-- |
---|
2 | * FCKeditor - The text editor for Internet - http://www.fckeditor.net |
---|
3 | * Copyright (C) 2003-2007 Frederico Caldeira Knabben |
---|
4 | * |
---|
5 | * == BEGIN LICENSE == |
---|
6 | * |
---|
7 | * Licensed under the terms of any of the following licenses at your |
---|
8 | * choice: |
---|
9 | * |
---|
10 | * - GNU General Public License Version 2 or later (the "GPL") |
---|
11 | * http://www.gnu.org/licenses/gpl.html |
---|
12 | * |
---|
13 | * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") |
---|
14 | * http://www.gnu.org/licenses/lgpl.html |
---|
15 | * |
---|
16 | * - Mozilla Public License Version 1.1 or later (the "MPL") |
---|
17 | * http://www.mozilla.org/MPL/MPL-1.1.html |
---|
18 | * |
---|
19 | * == END LICENSE == |
---|
20 | * |
---|
21 | * Test page for the "File Uploaders". |
---|
22 | --> |
---|
23 | <html> |
---|
24 | <head> |
---|
25 | <title>FCKeditor - Uploaders Tests</title> |
---|
26 | <script language="javascript"> |
---|
27 | |
---|
28 | function SendFile() |
---|
29 | { |
---|
30 | var sUploaderUrl = cmbUploaderUrl.value ; |
---|
31 | |
---|
32 | if ( sUploaderUrl.length == 0 ) |
---|
33 | sUploaderUrl = txtCustomUrl.value ; |
---|
34 | |
---|
35 | if ( sUploaderUrl.length == 0 ) |
---|
36 | { |
---|
37 | alert( 'Please provide your custom URL or select a default one' ) ; |
---|
38 | return ; |
---|
39 | } |
---|
40 | |
---|
41 | eURL.innerHTML = sUploaderUrl ; |
---|
42 | txtUrl.value = '' ; |
---|
43 | |
---|
44 | frmUpload.action = sUploaderUrl ; |
---|
45 | frmUpload.submit() ; |
---|
46 | } |
---|
47 | |
---|
48 | function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) |
---|
49 | { |
---|
50 | switch ( errorNumber ) |
---|
51 | { |
---|
52 | case 0 : // No errors |
---|
53 | txtUrl.value = fileUrl ; |
---|
54 | alert( 'File uploaded with no errors' ) ; |
---|
55 | break ; |
---|
56 | case 1 : // Custom error |
---|
57 | alert( customMsg ) ; |
---|
58 | break ; |
---|
59 | case 10 : // Custom warning |
---|
60 | txtUrl.value = fileUrl ; |
---|
61 | alert( customMsg ) ; |
---|
62 | break ; |
---|
63 | case 201 : |
---|
64 | txtUrl.value = fileUrl ; |
---|
65 | alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; |
---|
66 | break ; |
---|
67 | case 202 : |
---|
68 | alert( 'Invalid file' ) ; |
---|
69 | break ; |
---|
70 | case 203 : |
---|
71 | alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; |
---|
72 | break ; |
---|
73 | default : |
---|
74 | alert( 'Error on file upload. Error number: ' + errorNumber ) ; |
---|
75 | break ; |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | </script> |
---|
80 | </head> |
---|
81 | <body> |
---|
82 | <table cellSpacing="0" cellPadding="0" width="100%" border="0" height="100%"> |
---|
83 | <tr> |
---|
84 | <td> |
---|
85 | <table cellSpacing="0" cellPadding="0" width="100%" border="0"> |
---|
86 | <tr> |
---|
87 | <td nowrap> |
---|
88 | Select the "File Uploader" to use:<br> |
---|
89 | <select id="cmbUploaderUrl"> |
---|
90 | <option selected value="asp/upload.asp">ASP</option> |
---|
91 | <option value="aspx/upload.aspx">ASP.Net</option> |
---|
92 | <option value="cfm/upload.cfm">ColdFusion</option> |
---|
93 | <option value="lasso/upload.lasso">Lasso</option> |
---|
94 | <option value="php/upload.php">PHP</option> |
---|
95 | <option value="">(Custom)</option> |
---|
96 | </select> |
---|
97 | </td> |
---|
98 | <td nowrap> </td> |
---|
99 | <td width="100%"> |
---|
100 | Custom Uploader URL:<BR> |
---|
101 | <input id="txtCustomUrl" style="WIDTH: 100%; BACKGROUND-COLOR: #dcdcdc" disabled type="text"> |
---|
102 | </td> |
---|
103 | </tr> |
---|
104 | </table> |
---|
105 | <br> |
---|
106 | <table cellSpacing="0" cellPadding="0" width="100%" border="0"> |
---|
107 | <tr> |
---|
108 | <td noWrap> |
---|
109 | <form id="frmUpload" target="UploadWindow" enctype="multipart/form-data" action="" method="post"> |
---|
110 | Upload a new file:<br> |
---|
111 | <input type="file" name="NewFile"><br> |
---|
112 | <input type="button" value="Send it to the Server" onclick="SendFile();"> |
---|
113 | </form> |
---|
114 | </td> |
---|
115 | <td style="WIDTH: 16px"> </td> |
---|
116 | <td vAlign="top" width="100%"> |
---|
117 | Uploaded File URL:<br> |
---|
118 | <INPUT id="txtUrl" style="WIDTH: 100%" readonly type="text"> |
---|
119 | </td> |
---|
120 | </tr> |
---|
121 | </table> |
---|
122 | <br> |
---|
123 | Post URL: <span id="eURL"> </span> |
---|
124 | </td> |
---|
125 | </tr> |
---|
126 | <tr> |
---|
127 | <td height="100%"> |
---|
128 | <iframe name="UploadWindow" width="100%" height="100%" src="javascript:void(0)"></iframe> |
---|
129 | </td> |
---|
130 | </tr> |
---|
131 | </table> |
---|
132 | </body> |
---|
133 | </html> |
---|