I\'ve been using a PHP script to export data from my database (mysql) to a XLS file.
While the file export process is working fine on Firefox and IE.
I am g
I also faced the same problem. While downloading a file having comma in its name it was saying "duplicate headers received" and it is only in chrome. In Firefox it was OK. After that I just changed my code from
header("Content-Disposition: attachment; filename=$myfilename");
to
header("Content-Disposition: attachment; filename=\"$myfilename\"");
and it worked fine. Hope it will work for you.
Try this may help you, header('Content-Disposition: attachment; filename="'.$file_name.'"');
instead of
header('Content-Disposition: attachment; filename='.$file_name);
I've found out what my problem was in the header section of the PHP export code. The incorrect and correct lines are as follows:
Incorrect
header("Content-Disposition: attachment;filename=\"".$this->filename."\"");
Correct
header("Content-Disposition: attachment; filename=\"".$this->filename."\"");
The correction being adding a space between attachment; and filename
Hope this helps.
I had this same problem. However appearing only very rarely. Cause was similar but not quite the same.
Incorrect
header("Content-Disposition: attachment; filename=$filename");
Correct
header("Content-Disposition: attachment; filename=\"$filename\"");
$filename sometimes contained spaces resulting in mentionec Chrome error.