I was wondering if anyone know why the code after the header(Content-disposition: ...)
will not run? It writes and downloads the file, but it will not run the unlink()
line...
This code is within a few other if statements originally.
Here is the code:
$form1Array = array($_POST["namn"], $_POST["stad"]);
$form1String = serialize($form1Array);
$form1Fil = $_POST["namn"].".txt";
$midMappe = "midlertidig\\";
$fo_form1Fil = fopen($midMappe.$form1Fil, "w");
//
if (fwrite($fo_form1Fil, $form1String)) {
ignore_user_abort(true);
//
header("Content-type: text/plain");
header("Content-disposition: attachment; filename=".$form1Fil);
//
unlink($midMappe.$form1Fil);
} else {
echo "Could not save the file for download.";
}
Thank you. :)