getRequest(); $user = $request->getUser(); if ($request->isFormPost()) { $files = $request->getArr('file'); if (count($files) > 1) { return id(new AphrontRedirectResponse()) ->setURI('/file/?author='.phutil_escape_uri($user->getUserName())); } else { return id(new AphrontRedirectResponse()) ->setURI('/file/info/'.end($files).'/'); } } $panel_id = celerity_generate_unique_node_id(); $form = new AphrontFormView(); $form->setAction('/file/upload/'); $form->setUser($request->getUser()); $form ->setEncType('multipart/form-data') ->appendChild( id(new AphrontFormDragAndDropUploadControl()) ->setLabel('Files') ->setName('file') ->setError(true) ->setDragAndDropTarget($panel_id) ->setActivatedClass('aphront-panel-view-drag-and-drop')) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue('Done here!')); $panel = new AphrontPanelView(); $panel->setHeader('Upload File'); $panel->appendChild($form); $panel->setWidth(AphrontPanelView::WIDTH_FORM); $panel->setID($panel_id); return $this->buildStandardPageResponse( array($panel), array( 'title' => 'Upload File', )); } }