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

Commit 52e36ed

Browse files
committed
Fixed the filename for uploaded files
This is a backport of #160 for the 1.0.x branch
1 parent 06a5451 commit 52e36ed

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Goutte/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ protected function addPostFiles($request, array $files, $arrayName = '')
165165
if (is_array($info)) {
166166
if (isset($info['tmp_name'])) {
167167
if ('' !== $info['tmp_name']) {
168-
$request->addPostFile($name, $info['tmp_name']);
168+
$request->addPostFile($name, $info['tmp_name'], null, isset($info['name']) ? $info['name'] : null);
169169
} else {
170170
continue;
171171
}

Goutte/Tests/ClientTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function testUsesPostFiles()
131131

132132
$this->assertEquals(array(
133133
'test' => array(
134-
new PostFile('test', __FILE__, 'text/x-php')
134+
new PostFile('test', __FILE__, 'text/x-php', 'test.txt')
135135
)
136136
), $request->getPostFiles());
137137
}
@@ -174,7 +174,7 @@ public function testUsesPostFilesNestedFields()
174174

175175
$this->assertEquals(array(
176176
'form[test]' => array(
177-
new PostFile('form[test]', __FILE__, 'text/x-php')
177+
new PostFile('form[test]', __FILE__, 'text/x-php', 'test.txt')
178178
)
179179
), $request->getPostFiles());
180180
}

0 commit comments

Comments
 (0)