Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Commit

Permalink
Fixed the filename for uploaded files
Browse files Browse the repository at this point in the history
This is a backport of #160 for the 1.0.x branch
  • Loading branch information
stof committed Oct 9, 2014
1 parent 06a5451 commit 52e36ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Goutte/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions Goutte/Tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit 52e36ed

Please sign in to comment.