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 type="text/javascript"> 27 28function 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 if (document.getElementById('cmbType').value) { 46 frmUpload.action = frmUpload.action + '?Type='+document.getElementById('cmbType').value; 47 } 48 frmUpload.submit() ; 49} 50 51function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) 52{ 53 switch ( errorNumber ) 54 { 55 case 0 : // No errors 56 txtUrl.value = fileUrl ; 57 alert( 'File uploaded with no errors' ) ; 58 break ; 59 case 1 : // Custom error 60 alert( customMsg ) ; 61 break ; 62 case 10 : // Custom warning 63 txtUrl.value = fileUrl ; 64 alert( customMsg ) ; 65 break ; 66 case 201 : 67 txtUrl.value = fileUrl ; 68 alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; 69 break ; 70 case 202 : 71 alert( 'Invalid file' ) ; 72 break ; 73 case 203 : 74 alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; 75 break ; 76 default : 77 alert( 'Error on file upload. Error number: ' + errorNumber ) ; 78 break ; 79 } 80} 81 82 </script> 83 </head> 84 <body> 85 <table cellSpacing="0" cellPadding="0" width="100%" border="0" height="100%"> 86 <tr> 87 <td> 88 <table cellSpacing="0" cellPadding="0" width="100%" border="0"> 89 <tr> 90 <td nowrap> 91 Select the "File Uploader" to use:<br> 92 <select id="cmbUploaderUrl"> 93 <option selected value="asp/upload.asp">ASP</option> 94 <option value="aspx/upload.aspx">ASP.Net</option> 95 <option value="cfm/upload.cfm">ColdFusion</option> 96 <option value="lasso/upload.lasso">Lasso</option> 97 <option value="perl/upload.cgi">Perl</option> 98 <option value="php/upload.php">PHP</option> 99 <option value="py/upload.py">Python</option> 100 <option value="">(Custom)</option> 101 </select> 102 </td> 103 <td> 104 Resource Type<br /> 105 <select id="cmbType" name="cmbType"> 106 <option value="">None</option> 107 <option value="File">File</option> 108 <option value="Image">Image</option> 109 <option value="Flash">Flash</option> 110 <option value="Media">Media</option> 111 <option value="Invalid">Invalid Type (for testing)</option> 112 </select> 113 </td> 114 <td nowrap> </td> 115 <td width="100%"> 116 Custom Uploader URL:<BR> 117 <input id="txtCustomUrl" style="WIDTH: 100%; BACKGROUND-COLOR: #dcdcdc" disabled type="text"> 118 </td> 119 </tr> 120 </table> 121 <br> 122 <table cellSpacing="0" cellPadding="0" width="100%" border="0"> 123 <tr> 124 <td noWrap> 125 <form id="frmUpload" target="UploadWindow" enctype="multipart/form-data" action="" method="post"> 126 Upload a new file:<br> 127 <input type="file" name="NewFile"><br> 128 <input type="button" value="Send it to the Server" onclick="SendFile();"> 129 </form> 130 </td> 131 <td style="WIDTH: 16px"> </td> 132 <td vAlign="top" width="100%"> 133 Uploaded File URL:<br> 134 <INPUT id="txtUrl" style="WIDTH: 100%" readonly type="text"> 135 </td> 136 </tr> 137 </table> 138 <br> 139 Post URL: <span id="eURL"> </span> 140 </td> 141 </tr> 142 <tr> 143 <td height="100%"> 144 <iframe name="UploadWindow" width="100%" height="100%" src="javascript:void(0)"></iframe> 145 </td> 146 </tr> 147 </table> 148 </body> 149</html> 150