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
6 // Handle a file upload ajax request
7 if (isset($_GET['example']) && $_GET['example'] == 1) {
8 $upload = $DIC->upload();
9 try {
10 $upload->process();
11 // $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
12
13 // The File-Dropzones will expect a valid json-Status (success true or false).
14 echo json_encode(['success' => true, 'message' => 'Successfully uploaded file']);
15 } catch (Exception $e) {
16 // See above
17 echo json_encode(['success' => false, 'message' => $e->getMessage()]);
18 }
19 exit();
20 }
21
22 $uiFactory = $DIC->ui()->factory();
23 $renderer = $DIC->ui()->renderer();
24
25 $content = $uiFactory->panel()->standard('Panel', $uiFactory->legacy('Hello World, drag some files over me!'));
26 $uploadUrl = $_SERVER['REQUEST_URI'] . '&example=1';
27
28 $upload = $uiFactory->dropzone()->file()->wrapper($uploadUrl, $content);
29
30 return $renderer->render($upload);
31}
base()
Definition: base.php:2
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']