header file help need code

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
kshitizgp
Forum Newbie
Posts: 10
Joined: Sat Dec 03, 2011 12:56 am

header file help need code

Post by kshitizgp »

:offtopic: hey guyz when i run this code it directly download the file ..i want the option of save as to pop up ..cananyboy help and also i have file c folder ("protocol text") but the php in not rendering the that ....how can i do that?

sry am newbie in php ! :banghead:


header("Content-Type: plain/text");
header("Content-Disposition: Attachment; filename=c:\protocol.txt");
// header("Pragma: no-cache");

echo "text text ";

exit ;
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: header file help need code

Post by social_experiment »

I'm guessing you would have to use javascript for this
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
kshitizgp
Forum Newbie
Posts: 10
Joined: Sat Dec 03, 2011 12:56 am

Re: header file help need code

Post by kshitizgp »

@social_experiment


but when i use this code for PDF its show the save as option :mrgreen:
<?php
// We'll be outputting a PDF
header('Content-type: application/pdf');

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');

// The PDF source is in original.pdf
readfile('original.pdf');
?

:mrgreen:

v aint using any javascripts for this :O :O :crazy: :cry: 8O 8O 8O 8O 8O 8O
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: header file help need code

Post by social_experiment »

<span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span> wrote:v aint using any javascripts for this
Yeah i didn't mean "use javascript to download the file" i meant "use javascript to create the pop-up" but i see you already getting some type of pop-up with your existing php code; Good luck with it btw.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
kshitizgp
Forum Newbie
Posts: 10
Joined: Sat Dec 03, 2011 12:56 am

Re: header file help need code

Post by kshitizgp »

Yeah i didn't mean "use javascript to download the file" i meant "use javascript to create the pop-up" but i see you already getting some type of pop-up with your existing php code; Good luck with it btw.



Thnx :P ..it happened without javascripts :P
@social experiment :drunk:
Post Reply