Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F122021192
PhabricatorFileDropUploadController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jul 15, 08:54
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Jul 17, 08:54 (2 d)
Engine
blob
Format
Raw Data
Handle
27413112
Attached To
rPH Phabricator
PhabricatorFileDropUploadController.php
View Options
<?php
final
class
PhabricatorFileDropUploadController
extends
PhabricatorFileController
{
/**
* @phutil-external-symbol class PhabricatorStartup
*/
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
// NOTE: Throws if valid CSRF token is not present in the request.
$request
->
validateCSRF
();
$data
=
PhabricatorStartup
::
getRawInput
();
$name
=
$request
->
getStr
(
'name'
);
// If there's no explicit view policy, make it very restrictive by default.
// This is the correct policy for files dropped onto objects during
// creation, comment and edit flows.
$view_policy
=
$request
->
getStr
(
'viewPolicy'
);
if
(!
$view_policy
)
{
$view_policy
=
$viewer
->
getPHID
();
}
$file
=
PhabricatorFile
::
newFromXHRUpload
(
$data
,
array
(
'name'
=>
$request
->
getStr
(
'name'
),
'authorPHID'
=>
$viewer
->
getPHID
(),
'viewPolicy'
=>
$view_policy
,
'isExplicitUpload'
=>
true
,
));
return
id
(
new
AphrontAjaxResponse
())->
setContent
(
array
(
'id'
=>
$file
->
getID
(),
'phid'
=>
$file
->
getPHID
(),
'uri'
=>
$file
->
getBestURI
(),
));
}
}
Event Timeline
Log In to Comment