Reputation:
i am creating xml file to be downloaded but the link is not working. What is wrong with my code?
$xlsfile = 'localhost/debug/front/Aging_'.date("dmY_hiA").".xml";
echo "<br/>Start writeData<br/>";
$xml->writeData("$xlsfile");
echo '<a href="'.$xlsfile.'">'.$_SERVER['HTTP_HOST'].'/debug/'.$xlsfile.'</a>';
$message .= 'Extraction as of '.date("h:i A d M Y").' can now be downloaded <a href="'.$xlsfile.'"><strong>here</strong></a><br>';
thank you in advance
Upvotes: 1
Views: 163
Reputation: 1513
As I seen you are asking in the comments to other answers, This wont work when you send this as email to someone because, the file is generated/stored in your localhost. Localhost is your machine. Others wont have access to your localhost.
To have this available for everyone, you need to get a hosting and host the script there.
Upvotes: 0
Reputation: 282
Use a download attribute to the anchor tag. Rewrite as <a href="'.$xlsfile.'" download><strong>here</strong></a>
. Also correct your addresses to file.
Upvotes: 2