From 55c644f25fae5681d4e23ce462913d93a9d7845a Mon Sep 17 00:00:00 2001 From: uckelman Date: Mon, 10 May 2010 22:09:52 +0000 Subject: Typos. Added ability to set more headers. git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6849 67b53d14-2c14-4ace-a08f-0dab2b34000c --- src/HTTP_POST_multipart.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/HTTP_POST_multipart.php b/src/HTTP_POST_multipart.php index 4b24a4a..e6e92e4 100644 --- a/src/HTTP_POST_multipart.php +++ b/src/HTTP_POST_multipart.php @@ -99,7 +99,7 @@ class HTTP_POST_multipart { } protected static function buildPost($parts) { - $postParts[] = array(); + $postParts = array(); foreach ($parts as $part) { if (array_key_exists('filename', $part)) { @@ -126,15 +126,17 @@ class HTTP_POST_multipart { return $content; } - public function post($url) { + public function post($url, $headers = array()) { list($boundary, $content) = self::buildPost($this->_parts); $ctype = 'Content-Type: multipart/form-data; boundary="' . $boundary . '"'; + $header = implode($headers, EOL) . $ctype . EOL; + $ctx = stream_context_create( array('http' => array( 'method' => 'POST', - 'header' => $ctype, + 'header' => $header, 'content' => $content ) ) -- cgit v1.2.3