ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
base.php
Go to the documentation of this file.
1<?php
2function base()
3{
4 global $DIC;
5 $factory = $DIC->ui()->factory();
6 $renderer = $DIC->ui()->renderer();
7
8 // Handle a file upload ajax request
9 if (isset($_GET['example']) && $_GET['example'] == 1) {
10 $upload = $DIC->upload();
11 try {
12 $upload->process();
13 // $upload->moveFilesTo('/myPath/'); // Since we are in an example here, we do not move the files. But this would be the way wou move files using the FileUpload-Service
14
15 // The File-Dropzones will expect a valid json-Status (success true or false).
16 echo json_encode([ 'success' => true, 'message' => 'Successfully uploaded file' ]);
17 } catch (Exception $e) {
18 // See above
19 echo json_encode([ 'success' => false, 'message' => $e->getMessage() ]);
20 }
21 exit();
22 }
23
24 $uploadUrl = $_SERVER['REQUEST_URI'] . '&example=1';
25 $dropzone = $factory->dropzone()
26 ->file()
27 ->standard($uploadUrl)
28 ->withUploadButton($factory->button()->standard('Upload', ''));
29
30 return $renderer->render($dropzone);
31}
base()
Definition: base.php:2
$factory
Definition: metadata.php:43
exit
Definition: backend.php:16
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
global $DIC
Definition: saml.php:7
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']