Can any give me some idea on how to write the following code in PHP because the below code is in C#
var response = HttpContext.Current.Response;
response.Clear();
response.AppendCookie(new HttpCookie("fileDownloadToken", downloadTokenValue);
response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}",
desiredFileName));
response.Flush();
Thanks in advance
You can achieve this that way ,
<?php
$downloadTokenValue = 'Youre Value';
$desiredFileNames = 'Desired File Name Value';
setcookie("fileDownloadToken", $downloadTokenValue, time()+3600);
header("content-disposition: attachment;filename=$desiredFileNames");
?>
If you want to read that Cookie you can echo $_COOKIE["fileDownloadToken"]
;