header('Content-Type:application/x-download'); 

解决方案 »

  1.   

    主要发送下面两部分就成了.....
    header('Content-Type: 图片的MIME');
    header("Content-disposition: attachment; filename=\"图片文件名\""); 
    ....
      

  2.   

    改成如下形式
    $file_path   =   WWW_ROOT   .   $path   .   DS   .   $file_name; 
    $fileLineArray   =   file($file_path); 
    header('Content-Type: application/octet-stream'); 
    header("Content-Disposition:attachment;filename=$file_name"); 
    foreach($fileLineArray   as   $fileLine)   { 
                    echo   $fileLine; 

      

  3.   

    image.php
    <?php
    //数据库部分自己改
    $link=mysql_connect("localhost","root","123456"); 
    mysql_select_db('test',$link); 
    mysql_query("set names gb2312"); $recid = $_GET['recid'];
    $query="select * from tb_tpsc where id =  $recid";
    $result=mysql_query($query);
    $info = mysql_fetch_array($result);header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    header('Content-Type: image/jpeg'); 
    //想办法获取文件扩展名,我这里默认的给的是jpeg的,这个你没有存起来
    header("Content-Disposition:filename=". $info['tpmc'] . ".jpeg");
    echo $info['file'];
    ?>
      

  4.   

    下载的话,只需要加个链接到这个地址就OK.
    比如说 image.php?recid=xxx