Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96144188
FileUploadConduitAPIMethod.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, Dec 23, 02:16
Size
956 B
Mime Type
text/x-php
Expires
Wed, Dec 25, 02:16 (2 d)
Engine
blob
Format
Raw Data
Handle
23131353
Attached To
rPH Phabricator
FileUploadConduitAPIMethod.php
View Options
<?php
final
class
FileUploadConduitAPIMethod
extends
FileConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'file.upload'
;
}
public
function
getMethodDescription
()
{
return
'Upload a file to the server.'
;
}
public
function
defineParamTypes
()
{
return
array
(
'data_base64'
=>
'required nonempty base64-bytes'
,
'name'
=>
'optional string'
,
);
}
public
function
defineReturnType
()
{
return
'nonempty guid'
;
}
public
function
defineErrorTypes
()
{
return
array
(
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$data
=
$request
->
getValue
(
'data_base64'
);
$name
=
$request
->
getValue
(
'name'
);
$data
=
base64_decode
(
$data
,
$strict
=
true
);
$user
=
$request
->
getUser
();
$file
=
PhabricatorFile
::
newFromFileData
(
$data
,
array
(
'name'
=>
$name
,
'authorPHID'
=>
$user
->
getPHID
(),
));
return
$file
->
getPHID
();
}
}
Event Timeline
Log In to Comment