$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. Validation failed for one or more entities. See ‘EntityValidationErrors’解决方法【转载】

    摘自:http://www.cnblogs.com/douqiumiao/default.aspx?opt=msg Validation failed for one or more entities ...

  2. openssl 心脏滴血

    yum -y update openssl openssl verson rpm -q --changelog openssl | grep CVE-

  3. nginx,php相关

    nginx安装 http://www.nginx.cn/install php安装 https://segmentfault.com/a/1190000004123048#articleHeader5 ...

  4. Scanner概述

    * Scanner:用于接收键盘录入数据. * System类下有一个静态的字段: * public static final InputStream in; 标准的输入流,对应着键盘录入. * * ...

  5. JAVA为什么要配置环境变量,怎样配置

    自己总结些再加抄点:安装JDK后要配置环境变量,主要有三个:1 JAVA_HOME ->为JDK的安装目录,如:F:\JAVA\jdk1.6.0_042 CLASSPATH ->到哪里找需 ...

  6. java连接mysql :No Suitable Driver Found For Jdbc 解决方法

    今天出现编码出现了No suitable driver found for jdbc,又是找遍了网上的资料,基本上都说是以下个问题:    一是:连接URL格式出现了问题(Connection con ...

  7. view抖动效果

    1.使用属性动画 ViewPropertyAnimator.animate(webView).translationX(20).setInterpolator(new CycleInterpolato ...

  8. XE6移动开发环境搭建之IOS篇(8):在Mac OSX 10.8中安装XE6的PAServer(有图有真相)

    网上能找到的关于Delphi XE系列的移动开发环境的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 原创作品,请尊重作者劳动成果,转载请注明出处!!! 安装PAServer ...

  9. 59. Spiral Matrix && Spiral Matrix II

    Spiral Matrix Given a matrix of m x n elements (m rows, n columns), return all elements of the matri ...

  10. the philosophy behind of the design of the STL

    The concept of STL is based on a separation of data and operations. The data is managed by container ...