summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruckelman <uckelman@nomic.net>2010-05-10 22:09:52 +0000
committeruckelman <uckelman@nomic.net>2010-05-10 22:09:52 +0000
commit55c644f25fae5681d4e23ce462913d93a9d7845a (patch)
treeb4f672c3452a4659fa946062e608d50602da3240
parent0b70991fe6bfff44a670446aba321891ba1fdc0d (diff)
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
-rw-r--r--src/HTTP_POST_multipart.php8
1 files 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
)
)