Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F77137565
ConduitAPI_file_download_Method.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, Aug 12, 16:14
Size
818 B
Mime Type
text/x-php
Expires
Wed, Aug 14, 16:14 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
19823821
Attached To
rPH Phabricator
ConduitAPI_file_download_Method.php
View Options
<?php
/**
* @group conduit
*/
final
class
ConduitAPI_file_download_Method
extends
ConduitAPIMethod
{
public
function
getMethodDescription
()
{
return
"Download a file from the server."
;
}
public
function
defineParamTypes
()
{
return
array
(
'phid'
=>
'required phid'
,
);
}
public
function
defineReturnType
()
{
return
'nonempty base64-bytes'
;
}
public
function
defineErrorTypes
()
{
return
array
(
'ERR-BAD-PHID'
=>
'No such file exists.'
,
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$phid
=
$request
->
getValue
(
'phid'
);
$file
=
id
(
new
PhabricatorFile
())->
loadOneWhere
(
'phid = %s'
,
$phid
);
if
(!
$file
)
{
throw
new
ConduitException
(
'ERR-BAD-PHID'
);
}
return
base64_encode
(
$file
->
loadFileData
());
}
}
Event Timeline
Log In to Comment