0
I’m creating an ics file, which stores the dates and data of an event. I want the file when downloading to be at the root where the page is running. And when I load the page, the file is immediately downloaded, I wanted it to be when for example click on a link.
<?php
if (isset($_GET['txtstart']))
{
$txtstart = htmlentities($_GET['txtstart']);
}
if (isset($_GET['txtend']))
{
$txtend = htmlentities($_GET['txtend']);
}
if (isset($_GET['txttitle']))
{
$txttitle = htmlentities($_GET['txttitle']);
}
if (isset($_GET['txtdescription']))
{
$txtdescription = htmlentities($_GET['txtdescription']);
}
if (isset($_GET['mois']))
{
$mois = htmlentities($_GET['mois']);
}
if (isset($_GET['annee']))
{
$annee = htmlentities($_GET['annee']);
}
$Filename = "file.ics";
header("Content-Type: text/Calendar"); //ics
header("Content-Disposition: inline; filename=$Filename");
$DescDump = str_replace("\r", "=0D=0A=", $txtdescription);
$dateStart=$annee.$mois.$txtstart."000000";
$vCalStart = date("Ymd\THi00", $dateStart);
$dateEnd = $annee.$mois.$txtend."000000";
$vCalEnd = date("Ymd\THi00", $dateEnd); ?>
BEGIN:VCALENDAR
VERSION:2.0
PRODID:SSPCA Web Calendar
TZ:-07
BEGIN:VEVENT
SUMMARY:<?php echo $txttitle ."\n"; ?>
DESCRIPTION;ENCODING=QUOTED-PRINTABLE: <?php echo $DescDump ."\n"; ?>
DTSTART:<?php echo $vCalStart ."\n"; ?>
DTEND:<?php echo $vCalEnd ."\n"; ?>
END:VEVENT
END:VCALENDAR
The file is stored in the downloads folder, and I wanted it to be in the root folder where the page is. And the opening the page the file is immediately downloaded, I wanted it to be a link or button.
And what’s the problem?
– Jorge B.
The file is stored in the downloads folder, and I wanted it to be in the root folder where the page is. And the opening the page the file is immediately downloaded, I wanted it to be a link or Butão.
– akm