PHP实现文件上传下载实例(5)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Insert title here</title> </head> <body> <a href="https://www.jb51.net/article/1.rar">下载1.rar</a> <br /> <a href="https://www.jb51.net/article/1.jpg">下载1.jpg</a> <br /> <a href="doDownload.php?filename=https://www.jb51.net/article/1.jpg">通过程序下载1.jpg</a> <br /> <a href="doDownload.php?filename=../upload/nv.jpg">下载nv.jpg</a> <?php ?> </body> </html> <?php $filename=$_GET['filename']; header('content-disposition:attachment;filename='.basename($filename)); header('content-length:'.filesize($filename)); readfile($filename);

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/ea298b9661e36871e4f61030a6a78c86.html