From 8ad6e8f9223bd3ee214478b3e1247f9c7d8e91ec Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 27 Mar 2016 22:32:25 -0400 Subject: Add form field type 'file' Add the Form::field_file() function to allow form handlers to specify they expect to receive file from the end-user. This adds data about the file field to the form, but does not yet handle it in the populate function --- app/class/form.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app') diff --git a/app/class/form.class.php b/app/class/form.class.php index 9f103ba..e748afc 100644 --- a/app/class/form.class.php +++ b/app/class/form.class.php @@ -13,6 +13,7 @@ class Form $this->textFields = array(); $this->numbFields = array(); $this->enumFields = array(); + $this->fileFields = array(); $this->errorlist = array(); } @@ -85,6 +86,22 @@ class Form $this->field_enum($name, array("1", "0"), "0"); } + /* + * Add new file field to the form + */ + function field_file($name, $maxsize, $allowed_mime = null, $req = false) + { + if ($req !== true) + $req = false; + + $this->fileFields[] = array( + 'name' => $name, + 'maxsize' => $maxsize, + 'mime' => $allowed_mime, + 'req' => $req + ); + } + /* * Populate the form with input data from web page */ -- cgit v1.2.3