Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F116616633
ConduitAPI_file_uploadhash_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
Sat, Jun 7, 23:22
Size
922 B
Mime Type
text/x-php
Expires
Mon, Jun 9, 23:22 (2 d)
Engine
blob
Format
Raw Data
Handle
26641463
Attached To
rPH Phabricator
ConduitAPI_file_uploadhash_Method.php
View Options
<?php
/**
* @group conduit
*/
final
class
ConduitAPI_file_uploadhash_Method
extends
ConduitAPIMethod
{
public
function
getMethodDescription
()
{
return
"Upload a file to the server using content hash."
;
}
public
function
defineParamTypes
()
{
return
array
(
'hash'
=>
'required nonempty string'
,
'name'
=>
'required nonempty string'
,
);
}
public
function
defineReturnType
()
{
return
'phid or null'
;
}
public
function
defineErrorTypes
()
{
return
array
(
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$hash
=
$request
->
getValue
(
'hash'
);
$name
=
$request
->
getValue
(
'name'
);
$user
=
$request
->
getUser
();
$file
=
PhabricatorFile
::
newFileFromContentHash
(
$hash
,
array
(
'name'
=>
$name
,
'authorPHID'
=>
$user
->
getPHID
(),
));
if
(
$file
)
{
return
$file
->
getPHID
();
}
return
$file
;
}
}
Event Timeline
Log In to Comment