login.html代码:
<h2>文件下载</h2>
<input name="a" type="text" value=''/>
<input type="submit" value="下载" >
<hr>
info.php代码
<?php
$file = "D:phpStudy\PHPTutorial\WWW.demo06\audio\ColorPix.rar";
$fileName = basename($file);
header("Content-Type:application/octet-stream");
header("Content-Disposition:attachment;filename=".$fileName);
header("Accept-ranges:bytes");
header("Accept-Length:".filesize($file));
$h = fopen($file, 'r');
echo fread($h,filesize($file));
?>
新人自学,
HTML代码实现页面的下载和输入框,PHP代码实现单个文件下载功能;
如何实现,在html页面搜索框输入url,然后得到文件并且下载,
求教