Posted By

paulbooker on 11/16/08


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

luman
jamesming


Dynamic creation of a file and immediate download


 / Published in: PHP
 

  1. $file = "exported_data.txt" ;
  2. // open a file to export data ...
  3. $open = fopen($file,"w+") ;
  4. // write selected exported data to a file ..........
  5. fwrite($open,$exported_data);
  6. fclose($open);
  7. // download ...
  8. header("Content-Type: application/octet-stream");
  9. header("Content-disposition: attachment; filename=exported_data.txt");
  10. print($export_affiliate_data);
  11. exit();

Report this snippet  

You need to login to post a comment.