Skip to content
Advertisement

Tag: http-headers

PHP remove HTTP header

Something, I think Apache, adds these HTTP headers to all responses generated by PHP scripts: Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 This works ok for actual dynamic pages, but I have some page that, while generated by PHP, are mostly static, and I want the browser to cache them. Is there a way

Return a PHP page as an image

I am trying to read a image file (.jpeg to be exact), and ‘echo’ it back to the page output, but have is display an image… my index.php has an image link like this: and my php script does basically this: 1) read 1234.jpeg 2) echo file contents… 3) I have a feeling I need to return the output back

HTTP Headers for File Downloads

I’ve written a PHP script that handles file downloads, determining which file is being requested and setting the proper HTTP headers to trigger the browser to actually download the file (rather than displaying it in the browser). I now have a problem where some users have reported certain files being identified incorrectly (so regardless of extension, the browser will consider

How do I find the MIME type of a file with PHP?

I have an index.php file which has to process many different file types. How do I guess the filetype based on the REQUEST_URI? If I request http://site/image.jpg, and all requests redirect through index.php, which looks like this How would I make that work correctly? Should I test based on the extension of the file requested, or is there a way

Advertisement