Save csv file as PHP attachment file + Apache installation doesn't work
I have an interesting problem which I think is server related. I want the CSV data to be saved as a CSV file when the user clicks a button. It works fine on my development server, but in production it just sends content to the page. I'm guessing this is a server issue, but I'm really not sure what it might be. Could GZIP affect this?
My header code looks like this:
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Length: " . strlen($out));
header("Content-type: text/x-csv");
header("Content-Disposition: attachment; filename=$filename");
echo $out;
So this code above is running on a development server and in its production only CSV will be displayed on the page. Any ideas?
0
source to share
3 answers
Just use Wireshark ( http://www.wireshark.org ) and grab HTTP traffic for both and look for differences. Fiddler should also work
0
source to share