[ticket/10939] Added $_FILES handling to phpbb_request

PHPBB3-10939
This commit is contained in:
Fyorl 2012-08-09 12:31:49 +01:00
parent 64ff06cf87
commit 74423eaf12
2 changed files with 14 additions and 0 deletions

View file

@ -30,6 +30,7 @@ interface phpbb_request_interface
const REQUEST = 2; const REQUEST = 2;
const COOKIE = 3; const COOKIE = 3;
const SERVER = 4; const SERVER = 4;
const FILES = 5;
/**#@-*/ /**#@-*/
/** /**

View file

@ -34,6 +34,7 @@ class phpbb_request implements phpbb_request_interface
phpbb_request_interface::REQUEST => '_REQUEST', phpbb_request_interface::REQUEST => '_REQUEST',
phpbb_request_interface::COOKIE => '_COOKIE', phpbb_request_interface::COOKIE => '_COOKIE',
phpbb_request_interface::SERVER => '_SERVER', phpbb_request_interface::SERVER => '_SERVER',
phpbb_request_interface::FILES => '_FILES',
); );
/** /**
@ -283,6 +284,18 @@ class phpbb_request implements phpbb_request_interface
return $this->server($var_name, $default); return $this->server($var_name, $default);
} }
/**
* Shortcut method to retrieve $_FILES variables
*
* @param string $form_name The name of the file input form element
*
* @return array The uploaded file's information
*/
public function file($form_name)
{
return $this->variable($form_name, array(), false, phpbb_request_interface::FILES);
}
/** /**
* Checks whether a certain variable was sent via POST. * Checks whether a certain variable was sent via POST.
* To make sure that a request was sent using POST you should call this function * To make sure that a request was sent using POST you should call this function