Go to the source code of this file.
◆ with_custom_file_metadata()
with_custom_file_metadata |
( |
| ) |
|
Definition at line 2 of file with_custom_file_metadata.php.
3{
6 $renderer =
$DIC->ui()->renderer();
7
8
9 if (isset(
$_GET[
'example']) &&
$_GET[
'example'] == 2) {
10 $upload =
$DIC->upload();
11 try {
12 $upload->process();
13
14
15
16
17
18
19 echo json_encode(['success' => true, 'message' => 'Successfully uploaded file']);
20 }
catch (Exception
$e) {
21
22 echo json_encode([
'success' =>
false,
'message' =>
$e->getMessage()]);
23 }
25 }
26
27 $uploadUrl =
$_SERVER[
'REQUEST_URI'] .
'&example=2';
28 $dropzone =
$factory->dropzone()->file()->standard($uploadUrl)
29 ->withUserDefinedFileNamesEnabled(true)
30 ->withUserDefinedDescriptionEnabled(true)
31 ->withUploadButton(
$factory->button()->standard(
'Upload',
''));
32
33 return $renderer->render($dropzone);
34}
References $_GET, $_SERVER, $DIC, Vendor\Package\$e, $factory, and exit.