ILIAS  release_7 Revision v7.30-3-g800a261c036
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:4
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
global $DIC
Definition: goto.php:24
exit
Definition: login.php:29
$factory
Definition: metadata.php:58
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10