You've already forked EasyImages2.0
mirror of
https://github.com/icret/EasyImages2.0.git
synced 2025-12-13 11:43:58 +08:00
v2.6.9
* 2023-01-21 v2.6.9 Happy New Year - 修复BMP格式无法增加水印(不建议开启,非常耗时) - 修复上传用户组会串联变成管理员权限 [#61](https://github.com/icret/EasyImages2.0/issues/61) - 增加了上传提示和登录提示 - 增加自定义存储分类路径 设置方法参考 [PHP date() 函数](https://www.runoob.com/php/php-date.html) - 更改后台部分管理设置的位置 - 优化操作逻辑和信息提示
This commit is contained in:
@@ -5,38 +5,34 @@
|
||||
* https://www.php.cn/php-weizijiaocheng-394566.html
|
||||
*/
|
||||
//获取要下载的文件名
|
||||
require_once __DIR__.'/function.php';
|
||||
require_once __DIR__ . '/function.php';
|
||||
|
||||
// 获取下载路径
|
||||
if (empty($_GET['dw'])) {
|
||||
exit('No File Path');
|
||||
}else{
|
||||
} else {
|
||||
$dw = '../' . $_GET['dw'];
|
||||
// 检查文件是否存在
|
||||
if(!is_file($dw)){
|
||||
if (!is_file($dw)) {
|
||||
exit('No File');
|
||||
}
|
||||
}
|
||||
|
||||
// 过滤下载非指定上传文件格式
|
||||
$dw_extension = pathinfo($dw,PATHINFO_EXTENSION);
|
||||
$filter_extensions = explode(',',$config['extensions']);
|
||||
$dw_extension = pathinfo($dw, PATHINFO_EXTENSION);
|
||||
$filter_extensions = explode(',', $config['extensions']);
|
||||
|
||||
// 过滤下载其他格式
|
||||
$filter_other = array('php','json','log');
|
||||
$filter_other = array('php', 'json', 'log', 'lock');
|
||||
|
||||
// 先过滤后下载
|
||||
if(in_array($dw_extension,$filter_extensions) && !in_array($dw_extension,$filter_other)){
|
||||
if (in_array($dw_extension, $filter_extensions) && !in_array($dw_extension, $filter_other)) {
|
||||
//设置头信息
|
||||
header('Content-Disposition:attachment;filename=' . basename($dw));
|
||||
header('Content-Length:' . filesize($dw));
|
||||
//读取文件并写入到输出缓冲
|
||||
readfile($dw);
|
||||
exit;
|
||||
}else{
|
||||
} else {
|
||||
exit('Downfile Type Error');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user