browser won't display save dialog using Content_Disposition

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
allasso
Forum Commoner
Posts: 28
Joined: Fri Nov 28, 2008 1:24 pm

browser won't display save dialog using Content_Disposition

Post by allasso »

Hello,

I have also tried to get the browser to display a save dialog using (again, first thing on the page):

<?php
header('Content-type: text/html');
header('Content-Disposition: attachment; filename="file.html"');
readfile('file.html');
?>

I get no errors, it just doesn't work.

any ideas?

Thanks, Allasso
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: browser won't display save dialog using Content_Disposition

Post by requinix »

Just because you don't see any errors doesn't mean there are any.

I see two possible reasons why it doesn't work. Put a ini_set("display_errors", 1) before the header() calls and see if you get any messages then.
allasso
Forum Commoner
Posts: 28
Joined: Fri Nov 28, 2008 1:24 pm

Re: browser won't display save dialog using Content_Disposition

Post by allasso »

thanks much, I'll try that.
allasso
Forum Commoner
Posts: 28
Joined: Fri Nov 28, 2008 1:24 pm

Re: browser won't display save dialog using Content_Disposition

Post by allasso »

seems to work now. Inexperience the problem no doubt.

Thanks much.

Allasso
Post Reply