dolibarr  16.0.5
upload.php
1 <?php
2 /*
3  * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4  * Copyright (C) 2003-2010 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  * https://www.gnu.org/licenses/gpl.html
13  *
14  * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15  * https://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  * This is the "File Uploader" for PHP.
23  */
24 
25 require 'config.php'; // This include the main.inc.php
26 require 'util.php';
27 require 'io.php';
28 require 'commands.php';
29 
30 
38 function SendError($number, $text)
39 {
40  SendUploadResults($number, '', '', $text);
41 }
42 
43 
44 // Check if this uploader has been enabled.
45 if (empty($Config['Enabled'])) {
46  SendUploadResults('1', '', '', 'This file uploader is disabled. Please check the "filemanagerdol/connectors/php/config.php" file');
47 }
48 
49 $sCommand = 'QuickUpload';
50 
51 // The file type (from the QueryString, by default 'File', can be 'Image' or 'Media').
52 $sType = GETPOSTISSET('Type') ? GETPOST('Type') : 'File';
53 
54 $sCurrentFolder = "/";
55 
56 // Is enabled the upload?
57 if (!IsAllowedCommand($sCommand)) {
58  SendUploadResults('1', '', '', 'The ""'.$sCommand.'"" command isn\'t allowed');
59 }
60 
61 // Check if it is an allowed type.
62 if (!IsAllowedType($sType)) {
63  SendUploadResults(1, '', '', 'Invalid type specified');
64 }
65 
66 
67 
68 // @CHANGE
69 //FileUpload( $sType, $sCurrentFolder, $sCommand )
70 
71 // Get the CKEditor Callback
72 $CKEcallback = $_GET['CKEditorFuncNum'];
73 
74 // Get uploaded filr and move it at correct place. Note: Some tests on file name are also included into this function
75 FileUpload($sType, $sCurrentFolder, $sCommand, $CKEcallback);
FileUpload
This class is used to manage file upload using ajax.
Definition: fileupload.class.php:31
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:386