added Form::open_multipart and tweaked Upload_of rule.

This commit is contained in:
Taylor Otwell 2011-06-26 09:19:54 -05:00
parent dc01b3c26e
commit 567da2419f
2 changed files with 15 additions and 1 deletions

View File

@ -50,6 +50,20 @@ public static function open($action = null, $method = 'POST', $attributes = arra
return $html.PHP_EOL; 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. * Close a HTML form.
* *
@ -100,7 +114,6 @@ public static function raw_token()
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;
} }

View File

@ -1,5 +1,6 @@
<?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;