mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-12 00:26:13 +01:00
0c2147336c
Summary: Added explicit tags to files which are explicitly uploaded. Fixes T2749 Test Plan: Tested by checking out the files application. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2749 Differential Revision: https://secure.phabricator.com/D5406
36 lines
893 B
PHP
36 lines
893 B
PHP
<?php
|
|
|
|
final class PhabricatorFileDropUploadController
|
|
extends PhabricatorFileController {
|
|
|
|
public function processRequest() {
|
|
$request = $this->getRequest();
|
|
$user = $request->getUser();
|
|
|
|
// NOTE: Throws if valid CSRF token is not present in the request.
|
|
$request->validateCSRF();
|
|
|
|
$data = file_get_contents('php://input');
|
|
$name = $request->getStr('name');
|
|
|
|
$file = PhabricatorFile::newFromXHRUpload(
|
|
$data,
|
|
array(
|
|
'name' => $request->getStr('name'),
|
|
'authorPHID' => $user->getPHID(),
|
|
'isExplicitUpload' => true,
|
|
));
|
|
|
|
$view = new AphrontAttachedFileView();
|
|
$view->setFile($file);
|
|
|
|
return id(new AphrontAjaxResponse())->setContent(
|
|
array(
|
|
'id' => $file->getID(),
|
|
'phid' => $file->getPHID(),
|
|
'html' => $view->render(),
|
|
'uri' => $file->getBestURI(),
|
|
));
|
|
}
|
|
|
|
}
|