Browse Source

Merge pull request #590 from Vespakoen/develop

Adding has_file method to the Input class
Taylor Otwell 12 years ago
parent
commit
11f08fb737
1 changed files with 12 additions and 0 deletions
  1. 12 0
      laravel/input.php

+ 12 - 0
laravel/input.php

@@ -197,6 +197,18 @@ class Input {
 		return array_get($_FILES, $key, $default);
 	}
 
+	/**
+	 * Determine if the uploaded data contains a file.
+	 *
+	 * @param  string  $key
+	 * @return bool
+	 */
+	public static function has_file($key)
+	{
+		$file = static::file($key);
+		return ! empty($file['tmp_name']);
+	}
+	
 	/**
 	 * Move an uploaded file to permanent storage.
 	 *