实现php文件安全下载
来源:互联网 发布:太子妃升职记网络剧 编辑:程序博客网 时间:2024/05/07 20:38
public function downloads($name){
$name_tmp = explode("_",$name);
$type = $name_tmp[0];
$file_time = explode(".",$name_tmp[3]);
$file_time = $file_time[0];
$file_date = date("Y/md",$file_time);
$file_dir = SITE_PATH."/data/uploads/$type/$file_date/";
if (!file_exists($file_dir.$name)){
header("Content-type: text/html; charset=utf-8");
echo "File not found!";
exit;
} else {
$file = fopen($file_dir.$name,"r");
Header("Content-type: application/octet-stream");
Header("Accept-Ranges: bytes");
Header("Accept-Length: ".filesize($file_dir . $name));
Header("Content-Disposition: attachment; filename=".$name);
echo fread($file, filesize($file_dir.$name));
fclose($file);
}
}
0 0
- PHP实现文件安全下载
- PHP实现文件安全下载
- PHP实现文件安全下载
- PHP实现文件安全下载
- PHP实现文件安全下载
- PHP实现文件安全下载
- PHP实现文件安全下载
- PHP实现文件安全下载
- 实现php文件安全下载
- 实现php文件安全下载
- PHP实现文件安全下载 (藏)
- PHP实现文件安全下载的程序
- PHP 安全下载文件
- PHP 安全下载文件
- PHP安全下载文件
- php实现安全下载功能
- PHP实现文件下载
- PHP实现文件下载
- Python中的SSH
- Python建立SSH连接的方法
- python操作MySQL数据库
- 【转载】打算屏蔽百度蜘蛛,可以尝试以下方法
- 操作浏览器
- 实现php文件安全下载
- 【NOI OJ】1797 金银岛
- 将博客搬至CSDN
- png图片的文件存储格式
- ]JPEG图片存储格式及原理
- php使用curl库进行ssl双向认证
- JAVA和PHP通用的加解密整理版
- android、ios与服务器端php使用rsa加密解密通讯
- Android推送方案分析(MQTT/XMPP/GCM)