template.doc という名前のローカル サーバー内にサンプル ドキュメントを保存しています。次に、ファイル ディレクトリを sqlite テーブル内に保存します。ファイルディレクトリのパスを呼び出すことができましたが、ユーザーがそれをダウンロードできるようにするにはどうすればよいですか?
コード
<form id="List" name="List" method="post" action="">
<select name="List" id="List">
<?php
if ($Choice !="No")
{
$path = $_SERVER['DOCUMENT_ROOT']."/WEB/";
$fullPath = $path.$_GET['$Choice'];
echo "<form id=\"form7\" name=\"form7\" method=\"post\" action=\"\">";
echo "<input type=\"submit\" name=\"Download\" id=\"Download\" value=".$fullPath."/>";
if (file_exists($fullPath))
{
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($fullPath));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($fullPath));
ob_clean();
flush();
readfile($fullPath);
echo "<label>".$fullPath."</label>";
echo "<input type=\"submit\" name=\"Download\" id=\"Download\" value=".$fullPath."/>";
exit;
echo '</form>';
}
}
?>
リスト フォームの下にボタンを作成し、Microsoft Word をダウンロードするにはどうすればよいですか? ボタンではなく、Web サイトの Microsoft Word テキストをフラッシュするようになりました。可能かどうかアドバイスよろしくお願いします。ローカルテスト用です。どうもありがとう!