Skip to content

Commit

Permalink
delete file
Browse files Browse the repository at this point in the history
  • Loading branch information
maztch committed Mar 22, 2017
1 parent f7c2c45 commit e05f84f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/Ilovepdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Task extends Ilovepdf


/**
* Task constructor.
* Task constructor.
* @param null $publicKey
* @param null $secretKey
*/
Expand Down Expand Up @@ -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]);
}
}
}

0 comments on commit e05f84f

Please sign in to comment.