文件大于1GB

               {       
                       
                        //Big File
                        $file = $identity . ".cleanpdb.tar.gz";
                        $path = $webdatapath . "seq/" . $file;
                       
                        if(!file_exists($path))
                        {
                                echo "Sorry" . '<br>';
                                echo $file . " not exist";
                                return false;
                        }
                               
                               
                        header("Content-type: "."application/gz");
                        header('Content-Disposition: attachment; filename="'.basename($path));
                       
                        header("Cache-control: public");
                        header("Pragma: public");
                        header("Content-Length: ".filesize($path));
                        ob_end_clean();
                       
                        $fp = fopen($path,'r');
                        $file_size = filesize($path);
                        $buffer=1024;
                        $cur_size=0;
                        while(!feof($fp) && $file_size>$buffer+$cur_size) {
                                $file_data = fread($fp, $buffer);
                                echo $file_data;
                                $cur_size += $buffer;
                        }
                        $file_data = fread($fp, $file_size-$cur_size);
                        echo $file_data;
                        fclose($fp);
                       

                }   

 

相关文章:

  • 2021-08-28
  • 2022-02-23
  • 2022-02-18
  • 2021-08-27
  • 2021-09-02
猜你喜欢
  • 2022-12-23
  • 2021-10-03
  • 2021-12-21
  • 2022-12-23
  • 2021-05-21
  • 2021-10-25
相关资源
相似解决方案