From 9ab88d815daf39231d43b24d245470385863a840 Mon Sep 17 00:00:00 2001 From: Charles Peterson Date: Sat, 15 Mar 2014 23:32:34 -0500 Subject: [PATCH 1/2] Fix for new curl file upload method. http://stackoverflow.com/a/17033048/372215 --- src/Httpful/Request.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Httpful/Request.php b/src/Httpful/Request.php index db2dd9b..3341dff 100644 --- a/src/Httpful/Request.php +++ b/src/Httpful/Request.php @@ -382,9 +382,13 @@ public function expectsType($mime) public function attach($files) { foreach ($files as $key => $file) { - $this->payload[$key] = "@{$file}"; + if (function_exists('curl_file_create')) { + $this->payload[$key] = curl_file_create($file);; + } else { + $this->payload[$key] = "@{$file}"; + } } - + $this->sendsType(Mime::UPLOAD); return $this; } From 9eecc29b4bac0fdeda286dc2eef6b8dd76996102 Mon Sep 17 00:00:00 2001 From: Charles Peterson Date: Wed, 19 Mar 2014 16:48:26 -0500 Subject: [PATCH 2/2] Updated formating updated the specified formatting. Hope this helps. --- src/Httpful/Request.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Httpful/Request.php b/src/Httpful/Request.php index 3341dff..f287077 100644 --- a/src/Httpful/Request.php +++ b/src/Httpful/Request.php @@ -383,12 +383,11 @@ public function expectsType($mime) public function attach($files) { foreach ($files as $key => $file) { if (function_exists('curl_file_create')) { - $this->payload[$key] = curl_file_create($file);; + $this->payload[$key] = curl_file_create($file); } else { $this->payload[$key] = "@{$file}"; } } - $this->sendsType(Mime::UPLOAD); return $this; }