Download a Variable with PHP

Written by  on April 12, 2016 

You have a variable in php which should get into a file for download. But you don’t want to put it actually into a file? Then call the following script which does exactly that for you:

$filename=htmlspecialchars($_GET["name"]);
$content=$_GET['content'];
header("Content-type: text/plain");
header("Content-Disposition: attachment; filename=$filename");
echo("$content");

Category : Allgemein

Tags :

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.