views:

25

answers:

1

My understanding is that Zend HTTP Client is the best way to send (possibly) large files to the user; can any confirm this and show me an example? Or a better solution.

A: 

Zend_Http_Client is an advanced HTTP client which gives you the possibility to communicate with a HTTP server like a browser or other client.

It's a more advanced client like file_get_contents() or simply file().

So send data to the browser the best way is to send the data with readfile() or if you have only the binary data as a variable you can send is simply with echo.

eg.:

header("Content-Type: image/jpeg"); readfile("/path/to/the/file.jpg"); exit;

brusch