From dee0ead95075127d58e0575a1bd920882db569eb Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Wed, 15 Feb 2017 21:07:44 +0000 Subject: [PATCH] urlencode filename in multipart upload for issue #3 --- src/Interfax/Outbound/Delivery.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Interfax/Outbound/Delivery.php b/src/Interfax/Outbound/Delivery.php index aed5dfe..2787358 100644 --- a/src/Interfax/Outbound/Delivery.php +++ b/src/Interfax/Outbound/Delivery.php @@ -117,9 +117,10 @@ protected function resolveFiles(&$params) public function getMultipart() { $multipart = []; - foreach ($this->files as $file) { + foreach ($this->files as $i => $file) { $multipart[] = [ - 'name' => $file->getName(), + 'name' => 'file'.$i, + 'filename' => urlencode($file->getName()), 'contents' => $file->getBody(), 'headers' => $file->getHeader(), ]; @@ -147,8 +148,7 @@ public function send() $location = $this->client->post('/outbound/faxes', $params); } - - // TODO: clean this up + // retrieve ID (last element of location path) for outbound fax object $path = parse_url($location, PHP_URL_PATH); $bits = explode('/', $path); return $this->factory->instantiateClass('Interfax\Outbound\Fax', [$this->client, array_pop($bits)]);