Commit 567da241 by Taylor Otwell

added Form::open_multipart and tweaked Upload_of rule.

parent dc01b3c2
...@@ -51,6 +51,20 @@ class Form { ...@@ -51,6 +51,20 @@ class Form {
} }
/** /**
* 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. * Close a HTML form.
* *
* @return string * @return string
...@@ -100,7 +114,6 @@ class Form { ...@@ -100,7 +114,6 @@ class Form {
public static function label($name, $value, $attributes = array()) public static function label($name, $value, $attributes = array())
{ {
static::$labels[] = $name; static::$labels[] = $name;
return '<label for="'.$name.'"'.HTML::attributes($attributes).'>'.HTML::entities($value).'</label>'.PHP_EOL; return '<label for="'.$name.'"'.HTML::attributes($attributes).'>'.HTML::entities($value).'</label>'.PHP_EOL;
} }
......
<?php namespace System\Validation\Rules; <?php namespace System\Validation\Rules;
use System\File;
use System\Input; use System\Input;
use System\Validation\Rule; use System\Validation\Rule;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment