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