dolibarr  7.0.0-beta
frmupload.php
1 <?php
2 /* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2003-2010 Frederico Caldeira Knabben
4  *
5  * Source modified from part of fckeditor (http://www.fckeditor.net)
6  * retreived as GPL v2 or later
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 define('NOTOKENRENEWAL',1); // Disables token renewal
23 
24 require '../../../../main.inc.php';
25 ?>
26 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
27 <!--
28  * FCKeditor - The text editor for Internet - http://www.fckeditor.net
29  * Copyright (C) 2003-2010 Frederico Caldeira Knabben
30  *
31  * == BEGIN LICENSE ==
32  *
33  * Licensed under the terms of any of the following licenses at your
34  * choice:
35  *
36  * - GNU General Public License Version 2 or later (the "GPL")
37  * http://www.gnu.org/licenses/gpl.html
38  *
39  * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
40  * http://www.gnu.org/licenses/lgpl.html
41  *
42  * - Mozilla Public License Version 1.1 or later (the "MPL")
43  * http://www.mozilla.org/MPL/MPL-1.1.html
44  *
45  * == END LICENSE ==
46  *
47  * Page used to upload new files in the current folder.
48 -->
49 <html>
50  <head>
51  <title>File Upload</title>
52  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
53  <link href="browser.css" type="text/css" rel="stylesheet" >
54  <script type="text/javascript" src="js/common.js"></script>
55  <script type="text/javascript">
56 
57 function SetCurrentFolder( resourceType, folderPath )
58 {
59  var sUrl = oConnector.ConnectorUrl + 'Command=FileUpload' ;
60  sUrl += '&Type=' + resourceType ;
61  sUrl += '&CurrentFolder=' + encodeURIComponent( folderPath );
62 
63  document.getElementById('frmUpload').action = sUrl ;
64 }
65 
66 function OnSubmit()
67 {
68  if ( document.getElementById('NewFile').value.length == 0 )
69  {
70  alert( 'Please select a file from your computer' );
71  return false ;
72  }
73 
74  // Set the interface elements.
75  document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder (Upload in progress, please wait...)' ;
76  document.getElementById('btnUpload').disabled = true ;
77 
78  return true ;
79 }
80 
81 function OnUploadCompleted( errorNumber, data )
82 {
83  // Reset the Upload Worker Frame.
84  window.parent.frames['frmUploadWorker'].location = 'javascript:void(0)' ;
85 
86  // Reset the upload form (On IE we must do a little trick to avoid problems).
87  if ( document.all )
88  document.getElementById('NewFile').outerHTML = '<input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file">' ;
89  else
90  document.getElementById('frmUpload').reset();
91 
92  // Reset the interface elements.
93  document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder' ;
94  document.getElementById('btnUpload').disabled = false ;
95 
96  switch ( errorNumber )
97  {
98  case 0:
99  window.parent.frames['frmResourcesList'].Refresh();
100  break;
101  case 1: // Custom error.
102  alert( data );
103  break;
104  case 201:
105  window.parent.frames['frmResourcesList'].Refresh();
106  alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' );
107  break;
108  case 202:
109  alert( 'Invalid file' );
110  break;
111  default:
112  alert( 'Error on file upload. Error number: ' + errorNumber );
113  break;
114  }
115 }
116 
117 window.onload = function()
118 {
119  window.top.IsLoadedUpload = true ;
120 }
121  </script>
122  </head>
123  <body>
124  <form id="frmUpload" action="" target="frmUploadWorker" method="post" enctype="multipart/form-data" onsubmit="return OnSubmit();">
125  <table class="fullHeight" cellspacing="0" cellpadding="0" width="100%" border="0">
126  <tr>
127  <td class="nowrap">
128  <span id="eUploadMessage">Upload a new file in this folder</span><br>
129  <table cellspacing="0" cellpadding="0" width="100%" border="0">
130  <tr>
131  <td width="100%"><input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file"></td>
132  <td class="nowrap">&nbsp;<input id="btnUpload" type="submit" value="Upload"></td>
133  </tr>
134  </table>
135  </td>
136  </tr>
137  </table>
138  </form>
139  </body>
140 </html>
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:104
type
Definition: viewcat.php:283