Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92686080
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
Fri, Nov 22, 18:37
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Nov 24, 18:37 (2 d)
Engine
blob
Format
Raw Data
Handle
22486652
Attached To
rPH Phabricator
PholioImageUploadController.php
View Options
<?php
final
class
PholioImageUploadController
extends
PholioController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$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
=
PholioImage
::
initializeNewImage
()
->
setAuthorPHID
(
$viewer
->
getPHID
())
->
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