ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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:4
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
exit
Definition: login.php:29
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
$DIC
Definition: xapitoken.php:46