Fellow jedi, I need help in Force Download -> PROBLEM SOLVED

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
User avatar
deeessay
Forum Commoner
Posts: 55
Joined: Sat May 24, 2008 1:02 am

Fellow jedi, I need help in Force Download -> PROBLEM SOLVED

Post by deeessay »

Hi all,

I have a code that is supposed to download an xml file. The download is working only that when the xml file has been downloaded, there are HTML tags inserted along with it:

It looks like this:

<html>
<body>

<?xml ?>
<tag1>
<subtag1>
</subtag1>
</tag1>

</body>
</html>

I want to get the xml file only.... I wonder why those html tags were inserted... when I checked the source file, it only contains xml tags... anyway here's my code:


header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: text/xml");
header('Content-Disposition: attachment; filename="XMLforupload.xml"');
readfile("XMLforupload.xml");


I have tried looking for a solution but google can't seem to find a good match... any help is much appreciated.
Last edited by deeessay on Mon Jul 28, 2008 8:14 pm, edited 1 time in total.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Fellow jedi, I need help in Force Download

Post by jaoudestudios »

Maybe these 2 examples can help...

Step 1. Create XML file...
http://www.forum.jaoudestudios.com/view ... ?f=33&t=74

Step 2. Force Download...
http://www.forum.jaoudestudios.com/view ... p?f=13&t=8
User avatar
deeessay
Forum Commoner
Posts: 55
Joined: Sat May 24, 2008 1:02 am

Re: Fellow jedi, I need help in Force Download

Post by deeessay »

ah finally! a reply!
:D

thanks so much for replying! I'll check the site right away!
User avatar
deeessay
Forum Commoner
Posts: 55
Joined: Sat May 24, 2008 1:02 am

Re: Fellow jedi, I need help in Force Download

Post by deeessay »

Hi, I tried the force download function and I still got the same result -- there are still html tags added to my xml file.... argh this is driving me nuts!!!

:banghead:

please help me!!!
:cry:
User avatar
deeessay
Forum Commoner
Posts: 55
Joined: Sat May 24, 2008 1:02 am

Re: Fellow jedi, I need help in Force Download

Post by deeessay »

Nevermind the last post, I got the code working!

Thanks, jaoudestudios for your assistance!

good day!
Post Reply