This question already has an answer here:
- How to fix “Headers already sent” error in PHP 11 answers
i'm working on a wordpress template where files of my ftp get listed. if i click on a file I call d.php (d=download) where i simply pass along the path of the file and I want to force a download with
header('Content-Disposition: attachment; filename="'. $file .'"');
This is not working for me, because the browser keeps telling me:
Warning: Cannot modify header information - headers already sent by (output started at /clientdata/n5200-2-dynamic/a/l/mydomain.net.au/www/wp-content/themes/mytheme/d.php:25) in /clientdata/n5200-2-dynamic/a/l/mydomain.net.au/www/wp-content/themes/mytheme/d.php on line 45
any idea what I could do here? The d.php doesn't even include any wordpress specific stuff (get_header() or get_footer()) - it's just a simple php file in the template directory of my theme. Any idea what I could do here?
thank you