php下载大文件
2024-09-04 15:50:58
<?php
$file = @ fopen($file_dir . $file_name,"r");
$filesize=filesize($file_dir.$file_name);
header('Content-Description:File Transfer');
header("Content-Type:application/octet-stream");
header('Content-Transfer-Encoding:binary');
header("Accept-Ranges: bytes");
header('Expires:0');
header('Cache-Control:must-revalidate');
header('Pragma:public');
header("Content-Length:".$filesize);
header("Content-Disposition:attachment;filename=".$file_name);
ob_start();
fseek($file,0);
while (!feof($file)) {
set_time_limit(0);
print (fread($file, 1024 * 8)); ob_flush();
flush();
}
fclose($file);
最新文章
- Rasterizer Stage(读书笔记3 --- Real-Time rendering)
- SQL简单语句总结习题
- Windows Azure Redis 缓存服务
- JavaScript学习笔记- 正则表达式常用字符集及方法
- Lingo 做线性规划 - Revenue Management
- Assets/Sciprts/GameSciprt.js(97,46): BCE0044: expecting :, found &#39;,&#39;.
- Jquery 多选下拉列表插件jquery multiselect
- [AC自动机]题目合计
- 配置IIS服务器,APK文件下载
- LRU与MRU算法
- kafka环境搭建2-broker集群+zookeeper集群(转)
- window scipy install
- JS function立即调用的几种写法
- [js高手之路] html5 canvas教程 - 制作一个数码倒计时效果
- Bzoj4199:[NOI2015]品酒大会
- log4j详细配置
- openSUSE安装Qt5
- Hadoop序列化-流量汇总案例
- Latex 问题解决
- MySQL主从1205报错【转】