diff --git a/system/input.php b/system/input.php index 1e9fd973..b09ef673 100644 --- a/system/input.php +++ b/system/input.php @@ -69,6 +69,18 @@ public static function old($key = null, $default = null) return Arr::get(Session::get('laravel_old_input', array()), $key, $default); } + /** + * Get an item from the uploaded file data. + * + * @param string $key + * @param mixed $default + * @return array + */ + public static function file($key, $default = null) + { + return Arr::get($_FILES, $key, $default); + } + /** * Hydrate the input data for the request. * diff --git a/system/validation/rules/upload_of.php b/system/validation/rules/upload_of.php new file mode 100644 index 00000000..cf1d3393 --- /dev/null +++ b/system/validation/rules/upload_of.php @@ -0,0 +1,51 @@ +maximum) and $file['size'] > $this->maximum) + { + return false; + } + + if ( ! is_null($this->extensions) and ! in_array(File::extension($file['name']), $this->extensions)) + { + return false; + } + + return true; + } + +} \ No newline at end of file