From 567da2419f886d71fa95f42b34aa46eddfa6091b Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 26 Jun 2011 09:19:54 -0500 Subject: [PATCH] added Form::open_multipart and tweaked Upload_of rule. --- system/form.php | 15 ++++++++++++++- system/validation/rules/upload_of.php | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/system/form.php b/system/form.php index 2e3ffb42..49d60b36 100644 --- a/system/form.php +++ b/system/form.php @@ -50,6 +50,20 @@ public static function open($action = null, $method = 'POST', $attributes = arra return $html.PHP_EOL; } + /** + * Open a HTML form that accepts file uploads. + * + * @param string $action + * @param string $method + * @param array $attributes + * @return string + */ + public static function open_multipart($action = null, $method = 'POST', $attributes = array()) + { + $attributes['enctype'] = 'multipart/form-data'; + return static::open($action, $method, $attributes); + } + /** * Close a HTML form. * @@ -100,7 +114,6 @@ public static function raw_token() public static function label($name, $value, $attributes = array()) { static::$labels[] = $name; - return ''.PHP_EOL; } diff --git a/system/validation/rules/upload_of.php b/system/validation/rules/upload_of.php index 1b270aaa..e45dc56d 100644 --- a/system/validation/rules/upload_of.php +++ b/system/validation/rules/upload_of.php @@ -1,5 +1,6 @@