php client download image file

Hi,

How do I download an image file using the php client? I tried something like this:

$answer = $this->session->NewRequest(“Blob.Get”)->Set('input', 'doc:' . $path)->SendRequest();

header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.end(explode(“/“, $path))); readfile('tempstream');

But the downloaded file is not a valid image file. I tried changing the content-type to image/png as well. What am i missing?

Thanks

0 votes

1 answers

1469 views

ANSWER



I was able to fix this by changing readfile('tempstream') to echo $answer.

0 votes