Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2894774
PhabricatorFileUploadDialogController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorFileUploadDialogController.php
View Options
<?php
final
class
PhabricatorFileUploadDialogController
extends
PhabricatorFileController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
(
)
;
$e_file
=
true
;
$errors
=
array
(
)
;
if
(
$request
->
isDialogFormPost
(
)
)
{
$file_phids
=
$request
->
getStrList
(
'filePHIDs'
)
;
if
(
$file_phids
)
{
$files
=
id
(
new
PhabricatorFileQuery
(
)
)
->
setViewer
(
$viewer
)
->
withPHIDs
(
$file_phids
)
->
setRaisePolicyExceptions
(
true
)
->
execute
(
)
;
}
else
{
$files
=
array
(
)
;
}
if
(
$files
)
{
$results
=
array
(
)
;
foreach
(
$files
as
$file
)
{
$results
[
]
=
$file
->
getDragAndDropDictionary
(
)
;
}
$content
=
array
(
'files'
=>
$results
,
)
;
return
id
(
new
AphrontAjaxResponse
(
)
)
->
setContent
(
$content
)
;
}
else
{
$e_file
=
pht
(
'Required'
)
;
$errors
[
]
=
pht
(
'You must choose a file to upload.'
)
;
}
}
if
(
$request
->
getURIData
(
'single'
)
)
{
$allow_multiple
=
false
;
}
else
{
$allow_multiple
=
true
;
}
$form
=
id
(
new
AphrontFormView
(
)
)
->
appendChild
(
id
(
new
PHUIFormFileControl
(
)
)
->
setName
(
'filePHIDs'
)
->
setLabel
(
pht
(
'Upload File'
)
)
->
setAllowMultiple
(
$allow_multiple
)
->
setError
(
$e_file
)
)
;
return
$this
->
newDialog
(
)
->
setTitle
(
pht
(
'File'
)
)
->
setErrors
(
$errors
)
->
appendForm
(
$form
)
->
addSubmitButton
(
pht
(
'Upload'
)
)
->
addCancelButton
(
'/'
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 20:27 (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128435
Default Alt Text
PhabricatorFileUploadDialogController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment