Need help... http headers

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
MzD
Forum Newbie
Posts: 1
Joined: Fri Oct 11, 2002 8:24 am
Location: Sweden

Need help... http headers

Post by MzD »

This is the story:

I´ve created a getFile.php document that fetches a file and gets som filerelated stuff from the db.
It then make a header with content-type and so on.
So far so good.

Everything is working fine until I release it on the liveserver.
When I click on the link "download file" that links to the getFile.php document it trys to download the .php dokument instead of the file, if I choose to "open the file" it then ask to download the correct-file.

I suspect that the getFile.php (without header) is handled like an "unknown" file on the liveserver.

So, what can I do?
Can it be made som easy server confs. or do someone have a good solution?

Regards
Mikael Hellman
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

are you sure it will download the php-source-file?
That would be a major server-side fault.
Probably it's downloading the correct file but the name of the requested page is used as default name.
Do you have a header("Content-Disposition: attachment; filename=TheNameOfThatFile"); in your script?
afaik some browsers are very specific to the order of headers.
Post Reply