php
1<?php
2ini_set('display_errors', 1);
3error_reporting(E_ALL);
4
5if (filter_input(INPUT_POST, 'textarea')) {
6 $txt = filter_input(INPUT_POST, 'textarea');
7
8 header("Pragma: public");
9 header("Expires: 0");
10 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
11 header("Content-Transfer-Encoding: binary ");
12 header('Content-Type: application/octet-streams');
13 header("Content-Disposition: attachment; filename=\"text.txt\"");
14 echo $txt;
15 exit;
16}
17?><!DOCTYPE HTML>
18<html lang="ja">
19 <head>
20 <meta charset="UTF-8">
21 <title>サンプル</title>
22 </head>
23 <body>
24 <form action="" method="post">
25 <textarea name="textarea" cols="30" rows="10"></textarea>
26 <button>ダウンロード</button>
27 </form>
28 </body>
29</html>
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/08/28 10:40