|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-01-23 09:11 UTC] pajoye@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 16:00:01 2025 UTC |
Description: ------------ In my opinion it is difficult to send special HTTP headers. If you create a File programaticly and want to send it to the user, you have to use something like: <?php header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"file.csv\""); header("Content-Length: ".strlen($csv)); ?> So I have written some classes to make it easier. The same result of the upper example will be reached with the following: <?php $h = new HTTPHeader(); $h->ContentType()->ApplicationOctetStream(); $h->ContentDisposition()->Attachment()->Filename("file.csv"); $h->ContentLength($csv); ?> If you think it would be a helpful class mail me.