Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90531464
PholioImageUploadController.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, Nov 2, 12:42
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Nov 4, 12:42 (2 d)
Engine
blob
Format
Raw Data
Handle
22092692
Attached To
rPH Phabricator
PholioImageUploadController.php
View Options
<?php
/**
* @group pholio
*/
final
class
PholioImageUploadController
extends
PholioController
{
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
$phid
=
$request
->
getStr
(
'filePHID'
);
$replaces_phid
=
$request
->
getStr
(
'replacesPHID'
);
$title
=
$request
->
getStr
(
'title'
);
$description
=
$request
->
getStr
(
'description'
);
$file
=
id
(
new
PhabricatorFileQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
array
(
$phid
))
->
executeOne
();
if
(!
$file
)
{
return
new
Aphront404Response
();
}
if
(!
strlen
(
$title
))
{
$title
=
$file
->
getName
();
}
$image
=
id
(
new
PholioImage
())
->
attachFile
(
$file
)
->
setName
(
$title
)
->
setDescription
(
$description
)
->
makeEphemeral
();
$view
=
id
(
new
PholioUploadedImageView
())
->
setUser
(
$viewer
)
->
setImage
(
$image
)
->
setReplacesPHID
(
$replaces_phid
);
$content
=
array
(
'markup'
=>
$view
,
);
return
id
(
new
AphrontAjaxResponse
())->
setContent
(
$content
);
}
}
Event Timeline
Log In to Comment