forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPHUIFormFileControl.php
44 lines (35 loc) · 1 KB
/
PHUIFormFileControl.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
final class PHUIFormFileControl
extends AphrontFormControl {
private $allowMultiple;
protected function getCustomControlClass() {
return 'phui-form-file-upload';
}
public function setAllowMultiple($allow_multiple) {
$this->allowMultiple = $allow_multiple;
return $this;
}
public function getAllowMultiple() {
return $this->allowMultiple;
}
protected function renderInput() {
$file_id = $this->getID();
Javelin::initBehavior(
'phui-file-upload',
array(
'fileInputID' => $file_id,
'inputName' => $this->getName(),
'uploadURI' => '/file/dropupload/',
'chunkThreshold' => PhabricatorFileStorageEngine::getChunkThreshold(),
));
return phutil_tag(
'input',
array(
'type' => 'file',
'multiple' => $this->getAllowMultiple() ? 'multiple' : null,
'name' => $this->getName().'.raw',
'id' => $file_id,
'disabled' => $this->getDisabled() ? 'disabled' : null,
));
}
}