Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F8874334
PhabricatorFileDropUploadController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
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
(),
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Jun 9, 3:34 AM (1 d, 23 h)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
3379429
Default Alt Text
PhabricatorFileDropUploadController.php (1 KB)
Attached To
rP Phabricator
Event Timeline
Log In to Comment