summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2016-03-27 22:32:25 -0400
committerMalf Furious <m@lfurio.us>2016-03-27 22:32:25 -0400
commit8ad6e8f9223bd3ee214478b3e1247f9c7d8e91ec (patch)
tree3eab85641e14697fc668a29f422ab59b74c1f953
parent4d69a5ecca13bbda5843c176e1bc4df514f079d7 (diff)
downloadscrott-8ad6e8f9223bd3ee214478b3e1247f9c7d8e91ec.tar.gz
scrott-8ad6e8f9223bd3ee214478b3e1247f9c7d8e91ec.zip
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
-rw-r--r--app/class/form.class.php17
1 files changed, 17 insertions, 0 deletions
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();
}
@@ -86,6 +87,22 @@ class Form
}
/*
+ * 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
*/
function populate($input)