Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F547782
FileDownloadConduitAPIMethod.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
932 B
Referenced Files
None
Subscribers
None
FileDownloadConduitAPIMethod.php
View Options
<?php
final
class
FileDownloadConduitAPIMethod
extends
FileConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'file.download'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Download a file from the server.'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'phid'
=>
'required phid'
,
);
}
protected
function
defineReturnType
()
{
return
'nonempty base64-bytes'
;
}
protected
function
defineErrorTypes
()
{
return
array
(
'ERR-BAD-PHID'
=>
pht
(
'No such file exists.'
),
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$phid
=
$request
->
getValue
(
'phid'
);
$file
=
id
(
new
PhabricatorFileQuery
())
->
setViewer
(
$request
->
getUser
())
->
withPHIDs
(
array
(
$phid
))
->
executeOne
();
if
(!
$file
)
{
throw
new
ConduitException
(
'ERR-BAD-PHID'
);
}
return
base64_encode
(
$file
->
loadFileData
());
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 1:38 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
119960
Default Alt Text
FileDownloadConduitAPIMethod.php (932 B)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment