Commit 310a0dbe authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "(Bug1262928) Add support for filtering upload file types."

parents 104dd105 b0499974
......@@ -63,6 +63,7 @@ $form = array(
'type' => 'file',
'title' => get_string('csvfile', 'admin'),
'description' => get_string('groupcsvfiledescription', 'admin'),
'accept' => '.csv, text/csv, application/csv, text/comma-separated-values',
'rules' => array(
'required' => true
)
......
......@@ -45,6 +45,7 @@ $form = array(
'type' => 'file',
'title' => get_string('csvfile', 'admin'),
'description' => get_string('groupmemberscsvfiledescription', 'admin'),
'accept' => '.csv, text/csv, application/csv, text/comma-separated-values',
'rules' => array(
'required' => true
)
......
......@@ -92,6 +92,7 @@ $form = array(
'type' => 'file',
'title' => get_string('csvfile', 'admin'),
'description' => get_string('csvfiledescription', 'admin'),
'accept' => '.csv, text/csv, application/csv, text/comma-separated-values',
'rules' => array(
'required' => true
)
......
......@@ -36,7 +36,9 @@ function pieform_element_file(Pieform $form, $element) {/*{{{*/
if (isset($element['maxfilesize']) && is_int($element['maxfilesize'])){
$result = '<input type="hidden" name="MAX_FILE_SIZE" value="' . $element['maxfilesize'] . '"/>';
}
$result .= '<input type="file"' . $form->element_attributes($element) . '>';
$result .= '<input type="file"' . $form->element_attributes($element) .
(isset($element['accept']) ? ' accept="' . Pieform::hsc($element['accept']) . '"' : '') .
'>';
return $result;
}/*}}}*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment