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