1
chadm
General PHP help: use of header() with an HTML file
  • 2008/1/11 21:48

  • chadm

  • Just popping in

  • Posts: 50

  • Since: 2006/6/29


Hi All,

We have a strange scenario that is presenting itself and we're not sure how to handle it.

We have some legacy documents (MS Word, PDF, PPT & HTML) that need to be presented through a secured web site. The security will not be a problem, we have an Microsoft Active Directory tree and we have built the authentication scheme around the AD groups.

We have placed the folders of documents outside of our web root, we don't want them accessible to the world. We can scan the folder and display a link to download the file no problem. The link points to a PHP script that reads the file, modifies the HTTP header and ships the document off to the web browser. All of that works beautifully, except for the HTML files!

We want any HTML file to display in the web browser as clicking on any "web page" would work. Instead the browser prompts the user to download the file as if it were an unknown file type. I've check the mime/types and everything looks correct.

Can someone point me to anything that might help get this scenario working for us?

THANKS!!
Chad

2
vaughan
Re: General PHP help: use of header() with an HTML file
  • 2008/1/11 23:24

  • vaughan

  • Friend of XOOPS

  • Posts: 680

  • Since: 2005/11/26


coulkd always add a flag to your download script so that if the file extension is .html then it will just call the html file directly as any other page is displayed instead of routing it through your download script header().

3
chadm
Re: General PHP help: use of header() with an HTML file
  • 2008/1/11 23:36

  • chadm

  • Just popping in

  • Posts: 50

  • Since: 2006/6/29


I wish it were that simple. The files are not in the web root, so direct links to the files are not an option. That's why we are using a script to open and push the files to the web browser.

Any other ideas?

4
vaughan
Re: General PHP help: use of header() with an HTML file
  • 2008/1/11 23:53

  • vaughan

  • Friend of XOOPS

  • Posts: 680

  • Since: 2005/11/26


can't you use a bit of javascript to open a new window, and then use include("path/to/html document"); to fetch the doc & display it in the window?

basicly use an absolute path instead of an actual url..

5
chadm
Re: General PHP help: use of header() with an HTML file
  • 2008/1/12 2:02

  • chadm

  • Just popping in

  • Posts: 50

  • Since: 2006/6/29


I had not thought about simply including the file and having it sent on to the browser.

I'll try it when i get back to my office tomorrow.

Thanks a million for the idea! I'll let you know when we get it working.

6
chadm
Re: General PHP help: use of header() with an HTML file
  • 2008/1/12 3:45

  • chadm

  • Just popping in

  • Posts: 50

  • Since: 2006/6/29


I could not wait and went back to work...

The solution was pretty simple; if the extension of the file is htm or html simply include the file and end the script. The file shows in the web browser as an HTML file should.

Thank you very much for pointing me in the right direction for a solution!!!

THANKS!

Login

Who's Online

359 user(s) are online (248 user(s) are browsing Support Forums)


Members: 0


Guests: 359


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits