Skip to content

Commit

Permalink
[HttpFoundation] fixed FileBag to handle sub-requests
Browse files Browse the repository at this point in the history
  • Loading branch information
avalanche123 authored and fabpot committed Jan 24, 2011
1 parent 242562a commit 14e4b97
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Symfony/Component/HttpFoundation/FileBag.php
Expand Up @@ -39,7 +39,7 @@ public function replace(array $files = array())
*/
public function set($key, $value)
{
if (is_array($value)) {
if (is_array($value) || $value instanceof UploadedFile) {
parent::set($key, $this->convertFileInformation($value));
}
}
Expand All @@ -58,12 +58,15 @@ public function add(array $files = array())
/**
* Converts uploaded files to UploadedFile instances.
*
* @param array $file A (multi-dimensional) array of uploaded file information
* @param array|UploadedFile $file A (multi-dimensional) array of uploaded file information
*
* @return array A (multi-dimensional) array of UploadedFile instances
*/
protected function convertFileInformation(array $file)
protected function convertFileInformation($file)
{
if ($file instanceof UploadedFile) {
return $file;
}
$file = $this->fixPhpFilesArray($file);
if (is_array($file)) {
$keys = array_keys($file);
Expand Down

0 comments on commit 14e4b97

Please sign in to comment.