From e903d578d6e69d2fbe8d83f9e9505ced0f708a8e Mon Sep 17 00:00:00 2001 From: amouhzi Date: Mon, 4 Nov 2013 02:18:16 +0100 Subject: [PATCH] Stil have a bug --- src/Curl/Curl.php | 3 ++- tests/CurlTest.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index a0c0302..60f0dde 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -58,7 +58,8 @@ public function get($url, $data = array()) { public function post($url, $data=array()) { $this->setopt(CURLOPT_URL, $url); $this->setopt(CURLOPT_POST, TRUE); - $this->setopt(CURLOPT_POSTFIELDS, http_build_query($data)); + $data = http_build_query($data); + $this->setopt(CURLOPT_POSTFIELDS, $data); $this->_exec(); } diff --git a/tests/CurlTest.php b/tests/CurlTest.php index 4b407c7..ee54b71 100644 --- a/tests/CurlTest.php +++ b/tests/CurlTest.php @@ -93,7 +93,7 @@ public function testPostFilePathUpload() { $data = array( 'key' => 'image', - 'image' => $image, + 'image' => $image . ';filename=test.png;type=image/png', ); $this->curl->post($this->test_url . 'post_file_path_upload.php', $data);