Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F109385715
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
Mon, Apr 21, 17:30
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Apr 23, 17:30 (2 d)
Engine
blob
Format
Raw Data
Handle
25722083
Attached To
rPH Phabricator
PhabricatorFileDropUploadController.php
View Options
<?php
final
class
PhabricatorFileDropUploadController
extends
PhabricatorFileController
{
private
$viewObject
;
public
function
setViewObject
(
AphrontAbstractAttachedFileView
$view
)
{
$this
->
viewObject
=
$view
;
return
$this
;
}
public
function
getViewObject
()
{
if
(!
$this
->
viewObject
)
{
$this
->
viewObject
=
new
AphrontAttachedFileView
();
}
return
$this
->
viewObject
;
}
/**
* @phutil-external-symbol class PhabricatorStartup
*/
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
// NOTE: Throws if valid CSRF token is not present in the request.
$request
->
validateCSRF
();
$data
=
PhabricatorStartup
::
getRawInput
();
$name
=
$request
->
getStr
(
'name'
);
$file
=
PhabricatorFile
::
newFromXHRUpload
(
$data
,
array
(
'name'
=>
$request
->
getStr
(
'name'
),
'authorPHID'
=>
$user
->
getPHID
(),
'isExplicitUpload'
=>
true
,
));
$view
=
$this
->
getViewObject
();
$view
->
setFile
(
$file
);
return
id
(
new
AphrontAjaxResponse
())->
setContent
(
array
(
'id'
=>
$file
->
getID
(),
'phid'
=>
$file
->
getPHID
(),
'html'
=>
$view
->
render
(),
'uri'
=>
$file
->
getBestURI
(),
));
}
}
Event Timeline
Log In to Comment