3 final class PhabricatorFileUploadDialogController
4 extends PhabricatorFileController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $viewer = $request->getViewer();
11 if ($request->isDialogFormPost()) {
12 $file_phids = $request->getStrList('filePHIDs');
14 $files = id(new PhabricatorFileQuery())
16 ->withPHIDs($file_phids)
17 ->setRaisePolicyExceptions(true)
25 foreach ($files as $file) {
26 $results[] = $file->getDragAndDropDictionary();
33 return id(new AphrontAjaxResponse())->setContent($content);
35 $e_file = pht('Required');
36 $errors[] = pht('You must choose a file to upload.');
40 if ($request->getURIData('single')) {
41 $allow_multiple = false;
43 $allow_multiple = true;
46 $form = id(new AphrontFormView())
48 id(new PHUIFormFileControl())
49 ->setName('filePHIDs')
50 ->setLabel(pht('Upload File'))
51 ->setAllowMultiple($allow_multiple)
54 return $this->newDialog()
55 ->setTitle(pht('File'))
58 ->addSubmitButton(pht('Upload'))
59 ->addCancelButton('/');