[6779] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
---|
| 2 | <!-- |
---|
| 3 | * FCKeditor - The text editor for internet |
---|
| 4 | * Copyright (C) 2003-2006 Frederico Caldeira Knabben |
---|
| 5 | * |
---|
| 6 | * Licensed under the terms of the GNU Lesser General Public License: |
---|
| 7 | * http://www.opensource.org/licenses/lgpl-license.php |
---|
| 8 | * |
---|
| 9 | * For further information visit: |
---|
| 10 | * http://www.fckeditor.net/ |
---|
| 11 | * |
---|
| 12 | * "Support Open Source software. What about a donation today?" |
---|
| 13 | * |
---|
| 14 | * File Name: frmupload.html |
---|
| 15 | * Page used to upload new files in the current folder. |
---|
| 16 | * |
---|
| 17 | * File Authors: |
---|
| 18 | * Frederico Caldeira Knabben (fredck@fckeditor.net) |
---|
| 19 | --> |
---|
| 20 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
| 21 | <head> |
---|
| 22 | <link href="browser.css" type="text/css" rel="stylesheet" /> |
---|
| 23 | <script type="text/javascript" src="js/common.js"></script> |
---|
| 24 | <script type="text/javascript"> |
---|
| 25 | |
---|
| 26 | function SetCurrentFolder( resourceType, folderPath ) |
---|
| 27 | { |
---|
| 28 | var sUrl = oConnector.ConnectorUrl + 'Command=FileUpload' ; |
---|
| 29 | sUrl += '&Type=' + resourceType ; |
---|
| 30 | sUrl += '&CurrentFolder=' + escape( folderPath ) ; |
---|
| 31 | |
---|
| 32 | document.getElementById('frmUpload').action = sUrl ; |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | function OnSubmit() |
---|
| 36 | { |
---|
| 37 | if ( document.getElementById('NewFile').value.length == 0 ) |
---|
| 38 | { |
---|
| 39 | alert( 'Please select a file from your computer' ) ; |
---|
| 40 | return false ; |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | // Set the interface elements. |
---|
| 44 | document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder (Upload in progress, please wait...)' ; |
---|
| 45 | document.getElementById('btnUpload').disabled = true ; |
---|
| 46 | |
---|
| 47 | return true ; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | function OnUploadCompleted( errorNumber, data ) |
---|
| 51 | { |
---|
| 52 | // Reset the Upload Worker Frame. |
---|
| 53 | window.parent.frames['frmUploadWorker'].location = '../../../../../fckblank.html' ; |
---|
| 54 | |
---|
| 55 | // Reset the upload form (On IE we must do a little trick to avout problems). |
---|
| 56 | if ( document.all ) |
---|
| 57 | document.getElementById('NewFile').outerHTML = '<input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file">' ; |
---|
| 58 | else |
---|
| 59 | document.getElementById('frmUpload').reset() ; |
---|
| 60 | |
---|
| 61 | // Reset the interface elements. |
---|
| 62 | document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder' ; |
---|
| 63 | document.getElementById('btnUpload').disabled = false ; |
---|
| 64 | |
---|
| 65 | switch ( errorNumber ) |
---|
| 66 | { |
---|
| 67 | case 0 : |
---|
| 68 | window.parent.frames['frmResourcesList'].Refresh() ; |
---|
| 69 | break ; |
---|
| 70 | case 1 : // Custom error. |
---|
| 71 | alert( data ) ; |
---|
| 72 | break ; |
---|
| 73 | case 201 : |
---|
| 74 | window.parent.frames['frmResourcesList'].Refresh() ; |
---|
| 75 | alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' ) ; |
---|
| 76 | break ; |
---|
| 77 | case 202 : |
---|
| 78 | alert( 'Invalid file' ) ; |
---|
| 79 | break ; |
---|
| 80 | default : |
---|
| 81 | alert( 'Error on file upload. Error number: ' + errorNumber ) ; |
---|
| 82 | break ; |
---|
| 83 | } |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | window.onload = function() |
---|
| 87 | { |
---|
| 88 | window.top.IsLoadedUpload = true ; |
---|
| 89 | } |
---|
| 90 | </script> |
---|
| 91 | </head> |
---|
| 92 | <body bottommargin="0" topmargin="0"> |
---|
| 93 | <form id="frmUpload" action="" target="frmUploadWorker" method="post" enctype="multipart/form-data" onsubmit="return OnSubmit();"> |
---|
| 94 | <table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0"> |
---|
| 95 | <tr> |
---|
| 96 | <td nowrap="nowrap"> |
---|
| 97 | <span id="eUploadMessage">Upload a new file in this folder</span><br> |
---|
| 98 | <table cellspacing="0" cellpadding="0" width="100%" border="0"> |
---|
| 99 | <tr> |
---|
| 100 | <td width="100%"><input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file"></td> |
---|
| 101 | <td nowrap="nowrap"> <input id="btnUpload" type="submit" value="Upload"></td> |
---|
| 102 | </tr> |
---|
| 103 | </table> |
---|
| 104 | </td> |
---|
| 105 | </tr> |
---|
| 106 | </table> |
---|
| 107 | </form> |
---|
| 108 | </body> |
---|
| 109 | </html> |
---|