22 define(
'NOTOKENRENEWAL', 1);
24 require
'../../../../main.inc.php';
27 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
29 * FCKeditor - The text editor
for Internet - http:
30 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
34 * Licensed under the terms of any of the following licenses at your
37 * - GNU General Public License Version 2 or later (the
"GPL")
40 * - GNU Lesser General Public License Version 2.1 or later (the
"LGPL")
43 * - Mozilla Public License Version 1.1 or later (the
"MPL")
48 * Page used to upload
new files in the current folder.
52 <title>File Upload</title>
53 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
55 print
'<!-- Includes CSS for Dolibarr theme -->'.
"\n";
59 if (!empty($conf->modules_parts[
'theme'])) {
60 foreach ($conf->modules_parts[
'theme'] as $reldir) {
63 $themesubdir = $reldir;
70 print
'<link rel="stylesheet" type="text/css" href="'.$themepath.
'">'.
"\n";
72 <link href=
"browser.css" type=
"text/css" rel=
"stylesheet" >
73 <script
type=
"text/javascript" src=
"js/common.js"></script>
74 <script
type=
"text/javascript">
76 function SetCurrentFolder( resourceType, folderPath )
78 var sUrl = oConnector.ConnectorUrl +
'Command=FileUpload' ;
79 sUrl +=
'&Type=' + resourceType ;
80 sUrl +=
'&CurrentFolder=' + encodeURIComponent( folderPath );
82 document.getElementById(
'frmUpload').action = sUrl ;
87 console.log(
"Click on OnSubmit");
88 if ( document.getElementById(
'NewFile').value.length == 0 )
90 alert(
'Please select a file from your computer' );
95 document.getElementById(
'eUploadMessage').innerHTML =
'Upload a new file in this folder (Upload in progress, please wait...)' ;
96 document.getElementById(
'btnUpload').disabled = true ;
101 function OnUploadCompleted( errorNumber, data )
103 console.log(
"errorNumber = "+errorNumber);
106 window.parent.frames[
'frmUploadWorker'].location =
'javascript:void(0)' ;
110 document.getElementById(
'NewFile').outerHTML =
'<input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file">' ;
112 document.getElementById(
'frmUpload').reset();
115 document.getElementById(
'eUploadMessage').innerHTML =
'Upload a new file in this folder' ;
116 document.getElementById(
'btnUpload').disabled = false ;
118 switch ( errorNumber )
121 window.parent.frames[
'frmResourcesList'].Refresh();
127 window.parent.frames[
'frmResourcesList'].Refresh();
128 alert(
'A file with the same name is already available. The uploaded file has been renamed to "' + data +
'"' );
131 alert(
'Invalid file (Bad extension)' );
134 alert(
'Error on file upload. Error number: ' + errorNumber );
139 window.onload =
function()
141 window.top.IsLoadedUpload = true ;
146 <form
id=
"frmUpload" action=
"" target=
"frmUploadWorker" method=
"post" enctype=
"multipart/form-data" onsubmit=
"return OnSubmit();">
147 <input
type=
"hidden" name=
"token" value=
"<?php echo newToken(); ?>" />
148 <table
class=
"fullHeight" cellspacing=
"0" cellpadding=
"0" width=
"100%" border=
"0">
150 <td
class=
"nowrap valignmiddle">
151 <table width=
"100%" class=
"inline-block valignmiddle">
153 <td><input
id=
"NewFile" name=
"NewFile" type=
"file"></td>
154 <td
class=
"nowrap"> <input
id=
"btnUpload" type=
"submit" value=
"Upload" class=
"flat button"></td>
157 <!-- Section
for upload result message -->
158 <span
id=
"eUploadMessage"></span><br>