Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
| Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 17th, 2004, 04:46 PM
AAA AAA is offline
Registered User
Join Date: Jan 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Headers to Open and display files


I am developing a document manager that lets people view files hosted on a web server.

What Headers and functions do I need to send to make the browser download the file, and then display it?

The file could be in either JPEG or text format.

Old March 17th, 2004, 09:31 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts

You can use the header() function to sent the content type of the response. You can't force a browser to open the File Download dialog box -- in fact, if the browser knows how to display something inside it, it will. This includes most plain-text output, images, and (depending on your media player settings) songs and video.

look at header():

Simple search on google got me this list o' mime types you can send with an HTTP content-type header:

Take care,


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pdf files doesn't open Ciupaz BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 2 September 11th, 2008 04:36 PM
Open Excel to display created forms Borhani Excel VBA 2 January 19th, 2008 07:42 AM
display DataGrid column headers vertically neethling ASP.NET 1.0 and 1.1 Professional 0 May 13th, 2004 10:03 AM
Auto Open Files Hugh Excel VBA 1 December 17th, 2003 01:00 PM
Display names of open workbooks in a MsgBox rmcc Excel VBA 1 November 11th, 2003 05:59 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.