Posted By

bradless on 03/24/10


Tagged

http php file headers download


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

robertstefan


Prompt user to open or save when delivering file data stored in database with PHP


 / Published in: PHP
 

This set of headers works for me when I output file data from the database for the user to save or open.

  1. <?
  2. header("content-type: $mime_type");
  3. header("content-disposition: attachment; filename=$file_name");
  4. header("cache-control: private");
  5. header("pragma: private");
  6. echo $file_data;
  7. ?>

Report this snippet  

You need to login to post a comment.