diff --git a/src/Pluf/Form/Field/File.php b/src/Pluf/Form/Field/File.php index 5a1134e..a161884 100644 --- a/src/Pluf/Form/Field/File.php +++ b/src/Pluf/Form/Field/File.php @@ -37,6 +37,11 @@ class Pluf_Form_Field_File extends Pluf_Form_Field function clean($value) { parent::clean($value); + if (is_null($value) and !$this->required) { + return ''; // no file + } elseif (is_null($value) and $this->required) { + throw new Pluf_Form_Invalid(__('No files were uploaded. Please try to send the file again.')); + } $errors = array(); $no_files = false; switch ($value['error']) { diff --git a/src/Pluf/Utils.php b/src/Pluf/Utils.php index 256acb9..19e63ae 100644 --- a/src/Pluf/Utils.php +++ b/src/Pluf/Utils.php @@ -79,7 +79,6 @@ class Pluf_Utils */ static function cleanFileName($name) { - $name = mb_strtolower($name, 'UTF-8'); return mb_ereg_replace("/\015\012|\015|\012|\s|[^A-Za-z0-9\.\-\_]/", '_', $name); }