Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F970286
PhabricatorFileDropUploadController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
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
(),
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Jun 18, 5:01 AM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
225883
Default Alt Text
PhabricatorFileDropUploadController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment