MDL-78688 admin: define accepted filetype for uploaded preset file.

This commit is contained in:
Paul Holden 2023-07-10 16:14:02 +01:00
parent f12e1b82a0
commit ec92edec88
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164

View File

@ -42,8 +42,8 @@ class import_form extends moodleform {
$mform->setType('name', PARAM_TEXT);
// File upload.
$mform->addElement('filepicker', 'xmlfile',
get_string('selectfile', 'tool_admin_presets'));
$mform->addElement('filepicker', 'xmlfile', get_string('selectfile', 'tool_admin_presets'), null,
['accepted_types' => ['.xml']]);
$mform->addRule('xmlfile', null, 'required');
$this->add_action_buttons(true, get_string('import', 'tool_admin_presets'));