From 7ca349f02b85dcb4a5569d21a31c90b34e52ab93 Mon Sep 17 00:00:00 2001 From: uckelman Date: Sun, 9 May 2010 15:21:32 +0000 Subject: Added test. git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6807 67b53d14-2c14-4ace-a08f-0dab2b34000c --- src/HTTP_POST_multipart.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/HTTP_POST_multipart.php b/src/HTTP_POST_multipart.php index 7ccc36a..a4ce2a4 100644 --- a/src/HTTP_POST_multipart.php +++ b/src/HTTP_POST_multipart.php @@ -6,15 +6,23 @@ class HTTP_POST_multipart { protected $_parts = array(); - public function addData($name, $bytes) { + public function addData($name, $data) { + if ($name === null) throw new Exception('name is null'); + if ($data === null) throw new Exception('data is null'); + $this->_parts[] = array( 'name' => $name, - 'data' => $bytes + 'data' => $data ); } public function addFile($name, $filename, $mimetype, $charset, $encoding, $data) { + if ($name === null) throw new Exception('name is null'); + if ($filename === null) throw new Exception('filename is null'); + if ($mimetype === null) throw new Exception('mimetype is null'); + if ($data === null) throw new Exception('data is null'); + $this->_parts[] = array( 'name' => $name, 'filename' => $filename, -- cgit v1.2.3