0

I recently came across How to force file download with PHP which describes setting Content-Transfer-Encoding. Is this header applicable when used with this application when used to download a file via HTTP (it appears to be email related)? If so, what should it be set as for MS Word and Excel files, ZIP files, PDFs, and Text?

header("Content-Transfer-Encoding: Binary"); 
Community
  • 1
  • 1
user1032531
  • 24,767
  • 68
  • 217
  • 387

1 Answers1

5

It has been religiously included by carg-cult copy-paste programmers since it was mentioned in a comment to the readfile() manpage on PHP.net.

It indeed has little to do with HTTP and you can safely remove it.

Community
  • 1
  • 1
CodeCaster
  • 147,647
  • 23
  • 218
  • 272
  • Thanks and muchos gracias – user1032531 Jun 01 '14 at 15:14
  • 1
    Indeed. See also : "Thank you for your interest in PHP. The example functions as intended, this is the reason it has not been fixed - it is not broken. Examples found in documentation are intended to illustrate use, and that is all. They are not required to document best use, only use. As always, it is up to the programmer to determine the best use of software." Awesome. – Julian Reschke Jun 01 '14 at 15:34