diff --git a/src/Ilovepdf.php b/src/Ilovepdf.php index 7ca2835..e22c788 100644 --- a/src/Ilovepdf.php +++ b/src/Ilovepdf.php @@ -181,7 +181,6 @@ public function sendRequest($method, $endpoint, $body=null) throw new ProcessException($response->body->error->message, $response->code, null, $response); } else{ - echo "\n".$method." ->url: ".$to_server . '/v1/' . $endpoint; throw new \Exception($response->body->error->message); } } diff --git a/src/Task.php b/src/Task.php index 2bf4117..60997a5 100644 --- a/src/Task.php +++ b/src/Task.php @@ -31,7 +31,7 @@ class Task extends Ilovepdf /** - * Task constructor. + * Task constructor. * @param null $publicKey * @param null $secretKey */ @@ -253,4 +253,12 @@ public function ignorePassword($value) { $this->ignore_password = $value; } + + public function deleteFile($file){ + if (($key = array_search($file, $this->files)) !== false) { + $body = Request\Body::multipart(['task'=>$this->getTaskId(), 'server_filename'=>$file->server_filename]); + $this->sendRequest('post', 'upload/delete', $body); + unset($this->files[$key]); + } + } }