getRequest(); if ($request->isFormPost()) { $file = PhabricatorFile::newFromPHPUpload( idx($_FILES, 'file'), array( 'name' => $request->getStr('name'), )); return id(new AphrontRedirectResponse()) ->setURI('/file/info/'.phutil_escape_uri($file->getPHID()).'/'); } $form = new AphrontFormView(); $form->setAction('/file/upload/'); $form ->setEncType('multipart/form-data') ->appendChild( id(new AphrontFormFileControl()) ->setLabel('File') ->setName('file') ->setError(true)) ->appendChild( id(new AphrontFormTextControl()) ->setLabel('Name') ->setName('name') ->setCaption('Optional file display name.')) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue('Upload') ->addCancelButton('/file/')); $panel = new AphrontPanelView(); $panel->setHeader('Upload File'); $panel->appendChild($form); $panel->setWidth(AphrontPanelView::WIDTH_FORM); return $this->buildStandardPageResponse( array($panel), array( 'title' => 'Upload File', )); } }