|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-05-20 07:48 UTC] julian dot reschke at gmx dot de
Description: ------------ --- From manual page: http://www.php.net/function.readfile#refsect1- function.readfile-examples --- header('Content-Description: File Transfer'); This header field does not exist in HTTP. header('Content-Type: application/octet-stream'); This header field should either be set to the actual media type, or not set at all. header('Content-Disposition: attachment; filename='.basename($file)); This code will break if the filename contains non-token characters, such as ",", ";" or non-ASCII characters. See RFC 6266. header('Content-Transfer-Encoding: binary'); This header field does not exist in HTTP. header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 16:00:01 2025 UTC |
> header('Content-Description: File Transfer'); > This header field does not exist in HTTP. It does. See 2045 8. > header('Content-Type: application/octet-stream'); > This header field should either be set to the actual > media type, or not set at all. This is actual media type and it's perfectly valid content type identifier registered by IANA. See 2046 4.5.1. > header('Content-Transfer-Encoding: binary'); > This header field does not exist in HTTP. It does. See 2045 6.1. At least the last two cases are also a /de facto/ industry standard, both are widely accepted.> > header('Content-Description: File Transfer'); > > This header field does not exist in HTTP. > It does. See 2045 8. That is MIME. MIME is not HTTP. See <http://www.iana.org/assignments/message-headers/perm-headers.html>. > > header('Content-Type: application/octet-stream'); > > This header field should either be set to the actual > > media type, or not set at all. > This is actual media type and it's perfectly valid content type identifier registered by IANA. See 2046 4.5.1. It's a valid media type, but sending it doesn't help anybody. If you don't know the media type (and this seems to apply to the sample code), it is much better not to send it at all. > > header('Content-Transfer-Encoding: binary'); > > This header field does not exist in HTTP. > It does. See 2045 6.1. That is MIME. MIME is not HTTP. See RFC 2616, Section 19.4.5 (<http://greenbytes.de/tech/webdav/rfc2616.html#rfc.section.19.4.5>) and <http://www.iana.org/assignments/message-headers/perm-headers.html>. > At least the last two cases are also a /de facto/ industry standard, both are widely accepted. Not sure what cases you are referring to here. See above.