$file = dirname(dirname(__FILE__)) . $_GET['download'];            //获取图片的绝对路径
header("Content-type: octet/stream"); //下载的文件类型 这里是任何文件
header("Content-disposition:attachment;filename=".$file.";");
header("Content-Length:".filesize($file));
readfile($file);
exit;
protected function mk_csv($fileUrl) {

        header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . $fileUrl.';');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($fileUrl));
readfile($fileUrl);
exit; }

php 下载图片 文件的更多相关文章

  1. 利用Content-disposition实现无刷新下载图片文件

    今天在使用 tinypng.com 这个在线压缩图片的网站时,对其处理完图片后,可以无刷新下载图片感到好奇,于是了解了一下相关实现.无刷新下载可以利用MIME type或者设置Content-disp ...

  2. 使用fastDFS上传和下载图片文件

    package com.xuecheng.test.fastdfs;import org.csource.common.MyException;import org.csource.fastdfs.* ...

  3. WebClient 下载图片(文件)

    public static string SaveImage(string url, string newfilename) { WebClient mywebclient = new WebClie ...

  4. Java学习笔记——File类之文件管理和读写操作、下载图片

    Java学习笔记——File类之文件管理和读写操作.下载图片 File类的总结: 1.文件和文件夹的创建 2.文件的读取 3.文件的写入 4.文件的复制(字符流.字节流.处理流) 5.以图片地址下载图 ...

  5. C#下在图片文件本地

    //C#下载图片文件到本地,c#,c#下载,下载图片,下载文件,下载函数// 从图片地址下载图片到本地磁盘// 将二进制文件保存到磁盘 using System;using System.Drawin ...

  6. a 标签的download 属性在谷歌浏览器下无法下载图片,如何处理?

    a 标签的download属性在下载图片文件的时候是如何的方便,可是可是谷歌浏览器不支持下载,而是下载打开新窗口预览图片.这个兼容性问题如何解决呢? 了解了一番,HTMLCanvasElement.t ...

  7. response读取图片+下载图片

    读取图片 import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import ...

  8. js 下载图片与下载文件的方式一样;保存至本地 ASP.NET 方式

    <asp:Button ID="btnDownLoad" runat="server" style="display: none" T ...

  9. .Net Core 图片文件上传下载

    当下.Net Core项目可是如雨后春笋一般发展起来,作为.Net大军中的一员,我热忱地拥抱了.Net Core并且积极使用其进行业务的开发,我们先介绍下.Net Core项目下实现文件上传下载接口. ...

随机推荐

  1. 【转】Python 中map、reduce、filter函数

    转自:http://www.blogjava.net/vagasnail/articles/301140.html?opt=admin 介绍下Python 中 map,reduce,和filter 内 ...

  2. There is already an open DataReader associated with this Command which must be closed first." exception in Entity Framework

    Fixing the "There is already an open DataReader associated with this Command which must be clos ...

  3. android学习笔记57——Service_2

    Service生命周期 参考:http://codingnow.cn/android/515.html 应用程序启动服务的方式不同,其生命周期也有所不同. startService生命周期如下左图: ...

  4. IOCP简单实现

    本人工作是服务端性能测试,因工作需要开发机器人框架,选用底层的时候看到网上满大街的IOCP介绍,还有说IOCP比WSAAsyncSelect复杂等等,所以只好转WSAAsyncSelect实现. 因并 ...

  5. gerrit集成gitweb:Error injecting constructor, java.io.IOException: Permission denied

    使用gerrit账户在centos上安装gerrit,然后集成gitweb,gerrit服务启动失败,查看日志,报错信息如下: [-- ::,] ERROR com.google.gerrit.pgm ...

  6. oracle查询小结

    一.查询某表中某列值相同的记录: select * from t_acct_map where acct_id in (     select acct_id from t_acct_map grou ...

  7. strong reference cycle in block

    However, because the reference is weak, the object that self points to could be deallocated while th ...

  8. 树莓派3 Windows 10 IoT Core

    下载地址:https://developer.microsoft.com/zh-cn/windows/iot/Downloads 先下载安装 Windows 10 IoT 核心版仪表板: 安装完成后运 ...

  9. C/C++中的指针数组和数组指针

    1. 指针数组 定义:int *p[n],由于[]的优先级高于*,p和[]结合成一个数组,该数组的元素存储的是int类型的指针,由于数组内容是指针,因此p+1的步长是sizeof(int*),在32位 ...

  10. Centos 6 之samba 搭建

    学习linux从实践做起. 实验环境:vmware,cenots 6,xshell 注意:使用vmware 时,网络连接设置成桥接,和宿主机位于同一个网段. 实验需求:模拟实际公司文件服务器. 新建S ...