70079

Should content-transfer-encoding headers be use when downloading files via HTTP?

Question:

I recently came across <a href="https://stackoverflow.com/questions/7263923/how-to-force-file-download-with-php" rel="nofollow">How to force file download with PHP</a> 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");

Answer1:

It has been religiously included by carg-cult copy-paste programmers since it was <a href="http://web.archive.org/web/20040209023954/http://www.php.net/manual/en/function.readfile.php" rel="nofollow">mentioned in a comment to the readfile() manpage on PHP.net</a>.

It indeed <a href="https://stackoverflow.com/questions/7285372/is-content-transfer-encoding-an-http-header" rel="nofollow">has little to do with HTTP</a> and you can safely remove it.

Recommend

  • spark udf with data frame
  • Can you build a truly RESTful service that takes many parameters?
  • How gzip file gets stored in HDFS
  • Flex items with same property values are rendering in different sizes
  • jQuery: How to AJAXify WordPress Search?
  • How to autopopulate a field in SugarCRM form
  • Why cepheus don't send int without quotes to orion?
  • Differences in dis-assembled C code of GCC and Borland?
  • RxJava debounce by arbitrary value
  • Mysql - How to search for 26 records that each begins with the letter of the alphabet?
  • saving file generated by TCPDF
  • How to view images from protected folder with php?
  • Specifying Castle WCF Integration Facility Endpoint Behavior per Endpoint
  • How can I enlarge video fullscreen without the affected interface project in as3?
  • How do I access an unhandled exception in an MVC Error view?
  • Declaring variable dynamically in VB.net
  • Textfile Structure (tables)
  • HTTP/2 streams vs HTTP/1.1 connections
  • Email verification using google app script and google forms
  • Get one-time binding to work for ng-if
  • Email format validation in mvc3 view
  • Is there any way to access browser form field suggestions from JavaScript?
  • C# - Serializing and deserializing static member
  • Menu Color Fade on Hover with Jquery
  • Sending data from AppleScript to FileMaker records
  • Join two tables and save into third-sql
  • sending/ receiving email in Java
  • vba code to select only visible cells in specific column except heading
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • How to include full .NET prerequisite for Wix Burn installer
  • How to set the response of a form post action to a iframe source?
  • how does django model after text[] in postgresql [duplicate]
  • Cant find why the layout is getting smaller
  • Change div Background jquery
  • Turn off referential integrity in Derby? is it possible?
  • Qt: Run a script BEFORE make
  • Is it possible to post an object from jquery to bottle.py?
  • JaxB to read class hierarchy
  • reshape alternating columns in less time and using less memory