Skip to content

Commit

Permalink
fix(filefield): check all files, not only one
Browse files Browse the repository at this point in the history
Signed-off-by: btry <tbugier@teclib.com>
  • Loading branch information
btry committed Aug 29, 2018
1 parent ebfbd95 commit 3a26922
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions inc/fields/filefield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ public function isValid($value) {

if (is_array($_POST['_formcreator_field_' . $this->fields['id']])
&& count($_POST['_formcreator_field_' . $this->fields['id']]) > 0) {
$file = current($_POST['_formcreator_field_' . $this->fields['id']]);
if (is_file(GLPI_TMP_DIR . '/' . $file)) {
return true;
foreach ($_POST['_formcreator_field_' . $this->fields['id']] as $file) {
if (!is_file(GLPI_TMP_DIR . '/' . $file)) {
Session::addMessageAfterRedirect(__('A required file is missing:', 'formcreator') . ' ' . $this->fields['name'], false, ERROR);
return false;
}
}
}

Session::addMessageAfterRedirect(__('A required file is missing:', 'formcreator') . ' ' . $this->fields['name'], false, ERROR);
return false;
return true;
}

public static function getName() {
Expand Down

0 comments on commit 3a26922

Please sign in to comment.