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

Commit

Permalink
bug #182 Fixed the filename for uploaded files (stof)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.0 branch.

Discussion
----------

Fixed the filename for uploaded files

This is a backport of #160 for the 1.0.x branch

Commits
-------

52e36ed Fixed the filename for uploaded files
  • Loading branch information
fabpot committed Oct 9, 2014
2 parents 06a5451 + 52e36ed commit 794b196
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 794b196

Please sign in to comment.