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

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks and muchos gracias
Indeed. See also <bugs.php.net/bug.php?id=62074>: "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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.