From ee4dd5e987befb0001ab1eb438f8ba2292390895 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 26 Jun 2011 08:48:12 -0500 Subject: [PATCH] tweaked File::upload. --- system/file.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/system/file.php b/system/file.php index 6eb42f2c..4e982bf4 100644 --- a/system/file.php +++ b/system/file.php @@ -187,14 +187,19 @@ class File { } /** - * Move uploaded file, Use $_FILES['file'] for $file + * Move an uploaded file to storage. * - * @param array $file - * @param string $path + * @param string $key + * @param string $path * @return bool */ - public static function upload($file, $path) + public static function upload($key, $path) { - return ( ! move_uploaded_file($file['tmp_name'], $path)) ? false : true; + if ( ! array_key_exists($key, $_FILES)) + { + return false; + } + + return move_uploaded_file($_FILES[$key]['tmp_name'], $path); } } \ No newline at end of file