Reputation: 2051
I have a interesting problem that I think is server related. I want CSV data to be saved as a CSV file when a user clicks a button. It works fine on my development server, but on the production it just echo's the content to the page. My guess is that it must be a server issue, but I'm really not sure what it could be. Can GZIP affect this?
My header code is as follows:
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 works on a development server and on the production will just echo the CSV to the page. Any ideas?
Upvotes: 0
Views: 3177
Reputation: 2967
Just use Wireshark (http://www.wireshark.org) and capture the HTTP-traffic for both cases and look for differences. Fiddler is also supposed to work
Upvotes: 0
Reputation: 4784
Yeah I'd guess it's the mime-type as well. You may want to try the csv specific "text/csv" (RFC 4180) or the generic "application/octet-stream".
Upvotes: 0
Reputation: 13088
The only thing that I can think of is the mime-type. I've had some problems with mime-types (especially with .flv files) when moving from one server to another.
What I've used for .csv files is application/octet-stream
.
Hope that helps
Upvotes: 1