Posts Tagged ‘download’

show / download image with PHP

March 9th, 2010

To show a image in browser:

$file_path = ICON_DIR . $_GET['f'];
// TODO check file_path security
$file_name = basename($_GET['f']);
$fileLineArray = file($file_path);
header(‘Content-Type: image/jpeg’);
header(“Content-Disposition:filename=$file_name”);
foreach($fileLineArray as $fileLine)
echo $fileLine;

To force the browser to show the download dialogue, add a attachment header:

header(“Content-Disposition:filename=$file_name”);
header(“Content-disposition: attachment; filename=$file_name”);

Zend Framework (>=1.8) Step By Step

January 18th, 2010

Index:

  • environment set-up: eclipse / pdt / xDebug
  • quick start: zend.com / akrabat.com
  • zend application
  • db
  • auth / acl
  • router
  • session
  • module
  • ajax
  • cache
  • captcha / file
  • mail
  • test
  • performance
  • server clusters

Books and references: