# HTTP send file
Sends a file with support for (multiple) range requests.
It is able to throttle the download.
It is quite small and simple.
This class resembles the php http_send_file from PHP pecl
See:
<http://php.net/manual/en/function.http-send-file.php>
Install
With composer add to your "require" section:
composer require diversen/http-send-file
Usage example:
~~~php
use diversen\sendfile;
$s = new sendfile();
// if you don't set type - we will try to guess it
$s->contentType('application/epub+zip');
// if you don't set disposition (file name user agent will see)
// we will make a file name from file
$s->contentDisposition('test.epub');
// chunks of 40960 bytes per 0.1 secs
// if you don't set this then the values below are the defaults
// approx 409600 bytes per sec
$s->throttle(0.1, 40960);
// file
$file = '/some/dir/test.epub';
// send the file
try {
$s->send($file);
} catch (\Exception $e) {
echo $e->getMessage();
}
~~~
So you could just do like this:
~~~php
use diversen\sendfile;
$s = new sendfile();
// file
$file = '/some/dir/test.epub';
// send the file
try {
$s->send($file);
} catch (\Exception $e) {
echo $e->getMessage();
}
// but check the headers if it is not
// working as expected as the guessing
// of content-type does not always work
// correctly.
~~~
Without sending content-disposition header:
~~~php
// without sending content-disposition header
// 2. param = false
try {
$s->send($file, false);
} catch (\Exception $e) {
echo $e->getMessage();
}
~~~
# Credits
Much of the code is taken (and rewritten) from here:
<http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/>
The process is nicely explained here:
<http://www.media-division.com/the-right-way-to-handle-file-downloads-in-php/>
MIT © [Dennis Iversen](https://github.com/diversen)
没有合适的资源?快使用搜索试试~ 我知道了~
青提WiFi推广销售/WiFi分销小助手微信小程序+前端
共764个文件
js:215个
json:117个
wxss:113个
3 下载量 179 浏览量
2023-03-13
21:37:55
上传
评论
收藏 2.02MB ZIP 举报
温馨提示
青提WIFI推广销售/WiFi分销小助手微信小程序+前端 1、 修正批量导出图片丢失的错误; 2、完善佣金结算; 3、完善管理后台演示UI;
资源推荐
资源详情
资源评论
收起资源包目录
青提WiFi推广销售/WiFi分销小助手微信小程序+前端 (764个子文件)
chunk-elementUI.5dea96f6.css 234KB
chunk-705b6142.be194fd2.css 44KB
app.1120c498.css 11KB
chunk-75174089.0d2e5ff4.css 6KB
chunk-2683ae36.4ddb271c.css 6KB
chunk-794fb5b4.1ffe4f42.css 5KB
chunk-7098da6a.485a17b0.css 5KB
chunk-d620410c.f816b562.css 4KB
chunk-2338768c.fd73ac14.css 4KB
chunk-20d09194.34309ffd.css 4KB
chunk-libs.3dfb7769.css 3KB
chunk-167e9062.421a958f.css 3KB
chunk-29c49d16.b96a3fb6.css 3KB
chunk-b0b93616.ae3e7a3b.css 3KB
chunk-5323f134.8700337a.css 3KB
chunk-d52eff4e.7e52f01d.css 2KB
chunk-5b53a0cf.e964d4ba.css 2KB
chunk-5c146a54.57477f7b.css 1KB
chunk-18e9e872.92d6229e.css 1KB
chunk-8c3e5c78.ac868854.css 727B
chunk-a4a72e2c.9a9b8c27.css 727B
chunk-294603b2.d85aa774.css 727B
generate 3KB
icto.gif 8KB
loading.gif 4KB
index.html 9KB
index.html 1B
index.html 1B
index.html 1B
favicon.ico 66KB
cc_wifi.iml 889B
icon.jpg 378KB
preview.jpg 5KB
chunk-elementUI.740ad2c0.js 674KB
chunk-libs.da837fd1.js 230KB
chunk-705b6142.18ac6027.js 103KB
app.5662b7eb.js 34KB
app.96c905e9.js 34KB
app.fe262691.js 34KB
app.d00e1b55.js 34KB
chunk-20d09194.82e1f5e6.js 29KB
chunk-794fb5b4.1a674cee.js 29KB
chunk-794fb5b4.d8024919.js 29KB
chunk-794fb5b4.af2cffde.js 29KB
chunk-d620410c.cbdae7e0.js 28KB
chunk-2338768c.6205a07d.js 27KB
underscore.js 25KB
chunk-5323f134.ab2cf4f6.js 23KB
chunk-2683ae36.198df6f2.js 18KB
index.js 18KB
chunk-75174089.2b43c9d9.js 16KB
chunk-75174089.fac787df.js 16KB
index.js 16KB
chunk-b0b93616.03a92781.js 16KB
chunk-f4b6e6d0.e9962b94.js 15KB
chunk-5c146a54.9f429a71.js 15KB
chunk-18e9e872.96323544.js 15KB
chunk-5b53a0cf.fc2a8ed8.js 15KB
index.js 13KB
chunk-d52eff4e.ece611da.js 13KB
chunk-d52eff4e.a595c25a.js 13KB
chunk-d52eff4e.cd5f135f.js 13KB
chunk-29c49d16.0ee65510.js 12KB
regenerator.js 11KB
chunk-8c3e5c78.6ba07ecb.js 11KB
chunk-a4a72e2c.cb871fe0.js 11KB
chunk-a4a72e2c.cd0eb420.js 11KB
chunk-294603b2.c49bede5.js 10KB
index.js 10KB
index.js 9KB
index.js 9KB
index.js 8KB
index.js 8KB
index.js 8KB
index.js 8KB
create.js 7KB
index.js 7KB
index.js 7KB
tools.js 7KB
index.js 6KB
chunk-167e9062.ff6060d7.js 6KB
index.js 6KB
index.js 6KB
index.js 6KB
index.js 6KB
chunk-167e9062.e4b94d50.js 6KB
index.js 5KB
md5.js 5KB
index.js 5KB
index.js 5KB
index.js 5KB
index.js 5KB
obaa.js 5KB
index.js 5KB
index.js 5KB
index.js 5KB
poster.js 5KB
index.js 5KB
index.js 5KB
request.js 4KB
共 764 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
沃风云
- 粉丝: 5
- 资源: 29
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功