Tag Archives: header

Fix for Duplicate Headers Error 349


This error was bugging me whole of last week. This error is specific to Google Chrome. Not a bug in chrome itself though, as other browsers ignore duplicate headers, this seems like an issue with Chrome. This can be addressed easily the following ways, if you or your web app is sending out headers.

1. Enclose filename using “”. i.e

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

instead of

header('Content-Disposition: attachment; filename='.$file_name);

2. If possible replace spaces and commas (,) with underscores (_)

$file_name = str_replace(array('"', "'", ' ', ','), '_', $file_name);

3. Explicitly tell PHP to override headers by setting optional replace parameter to true.

header('Content-type: application/pdf', true);