Category Archives: Server-Side

DocumentRoot is like the open sky. Many times you are not the one watching it thru Hubble!

Fix for Duplicate Headers Error 349

Duplicate Headers Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION)

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);