24 if (!defined(
'NOCSRFCHECK')) define(
'NOCSRFCHECK',
'1');
25 if (!defined(
'NOTOKENRENEWAL')) define(
'NOTOKENRENEWAL',
'1');
26 if (!defined(
'NOREQUIREMENU')) define(
'NOREQUIREMENU',
'1');
27 if (!defined(
'NOREQUIREHTML')) define(
'NOREQUIREHTML',
'1');
30 require
'../../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/fileupload.class.php';
33 error_reporting(E_ALL | E_STRICT);
39 $fk_element =
GETPOST(
'fk_element',
'int');
40 $element =
GETPOST(
'element',
'alpha');
43 $upload_handler =
new FileUpload(null, $fk_element, $element);
45 header(
'Pragma: no-cache');
46 header(
'Cache-Control: no-store, no-cache, must-revalidate');
47 header(
'Content-Disposition: inline; filename="files.json"');
48 header(
'X-Content-Type-Options: nosniff');
49 header(
'Access-Control-Allow-Origin: *');
50 header(
'Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST, PUT, DELETE');
51 header(
'Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size');
53 switch (
$_SERVER[
'REQUEST_METHOD']) {
58 $upload_handler->get();
61 if (isset($_REQUEST[
'_method']) && $_REQUEST[
'_method'] ===
'DELETE') {
62 $upload_handler->delete();
64 $upload_handler->post();
68 $upload_handler->delete();
71 header(
'HTTP/1.0 405 Method Not Allowed');
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
This class is used to manage file upload using ajax.
print $_SERVER["PHP_SELF"]
Edit parameters.