Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F433287
FileUploadHashConduitAPIMethod.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
971 B
Referenced Files
None
Subscribers
None
FileUploadHashConduitAPIMethod.php
View Options
<?php
final
class
FileUploadHashConduitAPIMethod
extends
FileConduitAPIMethod
{
public
function
getAPIMethodName
()
{
// TODO: Deprecate this in favor of `file.allocate`.
return
'file.uploadhash'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Upload a file to the server using content hash.'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'hash'
=>
'required nonempty string'
,
'name'
=>
'required nonempty string'
,
);
}
protected
function
defineReturnType
()
{
return
'phid or null'
;
}
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
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 3, 3:37 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
61133
Default Alt Text
FileUploadHashConduitAPIMethod.php (971 B)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment