Вот мой код:
Код: Выделить всё
if(isset($_POST['submit_save'])) {
$file = "output.txt";
$output = $_POST['output_str'];
file_put_contents($file, $output);
$text = file_get_contents($file);
header("Content-type: application/text");
header("Content-Disposition: attachment; filename=\"$file\"");
echo $text;
} else {
$_POST['output_str'] = "";
}
Код: Выделить всё
The quick brown fox jumps over the lazy dog.
Вот содержимое файла output.txt:
Код: Выделить всё
The quick brown fox jumps over the lazy dog.
Save Textarea Content
.
.
. (all the way to
Подробнее здесь: https://stackoverflow.com/questions/766 ... ile-in-php