Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92729601
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 23, 05:18
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Nov 25, 05:18 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22499532
Attached To
rPH Phabricator
PholioImageUploadController.php
View Options
<?php
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