diff --git a/Goutte/Client.php b/Goutte/Client.php index 2bf2277..b962c55 100644 --- a/Goutte/Client.php +++ b/Goutte/Client.php @@ -165,7 +165,7 @@ protected function addPostFiles($request, array $files, $arrayName = '') if (is_array($info)) { if (isset($info['tmp_name'])) { if ('' !== $info['tmp_name']) { - $request->addPostFile($name, $info['tmp_name']); + $request->addPostFile($name, $info['tmp_name'], null, isset($info['name']) ? $info['name'] : null); } else { continue; } diff --git a/Goutte/Tests/ClientTest.php b/Goutte/Tests/ClientTest.php index 668ada5..654dd9d 100644 --- a/Goutte/Tests/ClientTest.php +++ b/Goutte/Tests/ClientTest.php @@ -131,7 +131,7 @@ public function testUsesPostFiles() $this->assertEquals(array( 'test' => array( - new PostFile('test', __FILE__, 'text/x-php') + new PostFile('test', __FILE__, 'text/x-php', 'test.txt') ) ), $request->getPostFiles()); } @@ -174,7 +174,7 @@ public function testUsesPostFilesNestedFields() $this->assertEquals(array( 'form[test]' => array( - new PostFile('form[test]', __FILE__, 'text/x-php') + new PostFile('form[test]', __FILE__, 'text/x-php', 'test.txt') ) ), $request->getPostFiles()); }