/EQT_V1/EQTWebApp/fckeditor/editor/filemanager/connectors/uploadtest.html

http://sgsoft-las.googlecode.com/ · HTML · 192 lines · 156 code · 14 blank · 22 comment · 0 complexity · 5ced923d2a5c07664193c4e5b3ed19dd MD5 · raw file

  1. <!--
  2. * FCKeditor - The text editor for Internet - http://www.fckeditor.net
  3. * Copyright (C) 2003-2009 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. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  27. <script type="text/javascript">
  28. // Automatically detect the correct document.domain (#1919).
  29. (function()
  30. {
  31. var d = document.domain ;
  32. while ( true )
  33. {
  34. // Test if we can access a parent property.
  35. try
  36. {
  37. var test = window.opener.document.domain ;
  38. break ;
  39. }
  40. catch( e ) {}
  41. // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
  42. d = d.replace( /.*?(?:\.|$)/, '' ) ;
  43. if ( d.length == 0 )
  44. break ; // It was not able to detect the domain.
  45. try
  46. {
  47. document.domain = d ;
  48. }
  49. catch (e)
  50. {
  51. break ;
  52. }
  53. }
  54. })() ;
  55. function SendFile()
  56. {
  57. var sUploaderUrl = cmbUploaderUrl.value ;
  58. if ( sUploaderUrl.length == 0 )
  59. sUploaderUrl = txtCustomUrl.value ;
  60. if ( sUploaderUrl.length == 0 )
  61. {
  62. alert( 'Please provide your custom URL or select a default one' ) ;
  63. return ;
  64. }
  65. eURL.innerHTML = sUploaderUrl ;
  66. txtUrl.value = '' ;
  67. var date = new Date()
  68. frmUpload.action = sUploaderUrl + '?time=' + date.getTime();
  69. if (document.getElementById('cmbType').value) {
  70. frmUpload.action = frmUpload.action + '&Type='+document.getElementById('cmbType').value;
  71. }
  72. if (document.getElementById('CurrentFolder').value) {
  73. frmUpload.action = frmUpload.action + '&CurrentFolder='+document.getElementById('CurrentFolder').value;
  74. }
  75. frmUpload.submit() ;
  76. }
  77. function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
  78. {
  79. switch ( errorNumber )
  80. {
  81. case 0 : // No errors
  82. txtUrl.value = fileUrl ;
  83. alert( 'File uploaded with no errors' ) ;
  84. break ;
  85. case 1 : // Custom error
  86. alert( customMsg ) ;
  87. break ;
  88. case 10 : // Custom warning
  89. txtUrl.value = fileUrl ;
  90. alert( customMsg ) ;
  91. break ;
  92. case 201 :
  93. txtUrl.value = fileUrl ;
  94. alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
  95. break ;
  96. case 202 :
  97. alert( 'Invalid file' ) ;
  98. break ;
  99. case 203 :
  100. alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ;
  101. break ;
  102. default :
  103. alert( 'Error on file upload. Error number: ' + errorNumber ) ;
  104. break ;
  105. }
  106. }
  107. </script>
  108. </head>
  109. <body>
  110. <table cellSpacing="0" cellPadding="0" width="100%" border="0" height="100%">
  111. <tr>
  112. <td>
  113. <table cellSpacing="0" cellPadding="0" width="100%" border="0">
  114. <tr>
  115. <td nowrap>
  116. Select the "File Uploader" to use: <br>
  117. <select id="cmbUploaderUrl">
  118. <option selected value="asp/upload.asp">ASP</option>
  119. <option value="aspx/upload.aspx">ASP.Net</option>
  120. <option value="cfm/upload.cfm">ColdFusion</option>
  121. <option value="lasso/upload.lasso">Lasso</option>
  122. <option value="perl/upload.cgi">Perl</option>
  123. <option value="php/upload.php">PHP</option>
  124. <option value="py/upload.py">Python</option>
  125. <option value="">(Custom)</option>
  126. </select>
  127. </td>
  128. <td>
  129. Resource Type<br />
  130. <select id="cmbType" name="cmbType">
  131. <option value="">None</option>
  132. <option value="File">File</option>
  133. <option value="Image">Image</option>
  134. <option value="Flash">Flash</option>
  135. <option value="Media">Media</option>
  136. <option value="Invalid">Invalid Type (for testing)</option>
  137. </select>
  138. </td>
  139. <td>
  140. Current Folder: <br>
  141. <input type="text" name="CurrentFolder" id="CurrentFolder" value="/">
  142. </td>
  143. <td nowrap>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
  144. <td width="100%">
  145. Custom Uploader URL:<BR>
  146. <input id="txtCustomUrl" style="WIDTH: 100%; BACKGROUND-COLOR: #dcdcdc" disabled type="text">
  147. </td>
  148. </tr>
  149. </table>
  150. <br>
  151. <table cellSpacing="0" cellPadding="0" width="100%" border="0">
  152. <tr>
  153. <td noWrap>
  154. <form id="frmUpload" target="UploadWindow" enctype="multipart/form-data" action="" method="post">
  155. Upload a new file:<br>
  156. <input type="file" name="NewFile"><br>
  157. <input type="button" value="Send it to the Server" onclick="SendFile();">
  158. </form>
  159. </td>
  160. <td style="WIDTH: 16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
  161. <td vAlign="top" width="100%">
  162. Uploaded File URL:<br>
  163. <INPUT id="txtUrl" style="WIDTH: 100%" readonly type="text">
  164. </td>
  165. </tr>
  166. </table>
  167. <br>
  168. Post URL: <span id="eURL">&nbsp;</span>
  169. </td>
  170. </tr>
  171. <tr>
  172. <td height="100%">
  173. <iframe name="UploadWindow" width="100%" height="100%" src="javascript:void(0)"></iframe>
  174. </td>
  175. </tr>
  176. </table>
  177. </body>
  178. </html>