Google Chrome Errors When Exporting XLS File Using PHP

I am using a PHP script to export data from my database (mysql) to an XLS file.

So far, the file export process works fine in Firefox and IE.

I get errors when trying to export using Google Chrome.

Google Chrome Error:

    Duplicate headers received from server

The response from the server contained duplicate headers. This problem is generally the result of a misconfigured website or proxy. Only the website or proxy administrator can fix this issue.

Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple distinct Content-Disposition headers received. This is disallowed to protect against HTTP response splitting attacks.

I need help.

thank

+5
source share
3 answers

I found out that my problem was in the header section of the PHP export code. Wrong and correct lines are as follows:

Wrong

header("Content-Disposition: attachment;filename=\"".$this->filename."\"");

Correct

header("Content-Disposition: attachment; filename=\"".$this->filename."\"");

Correction, adding space between the attachment; and file_name

Hope this helps.

+9
source

. . , .

header("Content-Disposition: attachment; filename=$filename");

header("Content-Disposition: attachment; filename=\"$filename\"");

$filename , Chrome.

+3

. " , ", . Firefox .
header("Content-Disposition: attachment; filename=$myfilename"); header("Content-Disposition: attachment; filename=\"$myfilename\"");, . , .

+1

All Articles