我正在使用此功能来创建和下载ZIP文件。我测试过,它适用于少于200MB的文件。当我尝试下载超过250MB的文件时,下载会部分停止,并且在打开时显示已损坏。
public function download_songs($bs_id){
// public function download_songs(){
$this->load->library('zip');
$this->load->helper('file');
$this->load->helper('download');
// $bs_id = $this->input->post('bs_id');
$bsl_data = $this->public_model->get_result_array_with_one_where('buy_song_list','psl_bs_id',$bs_id);
$bal_data = $this->public_model->get_result_array_with_one_where('buy_album_list','bal_bs_id',$bs_id);
$d_type = 0;
foreach($bsl_data as $bs_row){
$dateA = $bs_row['psl_created'];
// your second date coming from a mysql database (date fields)
date_default_timezone_set('Asia/Kolkata');
$dateB = date("Y-m-d H:i:s");
$timediff = strtotime($dateB) - strtotime($dateA);
//if($timediff>10800){ // echo 'more than 3 hours';
if($timediff > 86400){ //echo 'more than 24 hours';
$this->db->where('psl_mml_id',$bs_row['psl_mml_id'])
->set('psl_status','1')
->update('buy_song_list');
$d_type = 0;
}
else{
// echo 'less than 3 hours';
if($bs_row['psl_status']=='0'){
$mml_data = $this->public_model->get_result_array('music_mp3_list','','','mml_id',$bs_row['psl_mml_id']);
if($bs_row['psl_file_type']=='MP3'){
$f = $mml_data['mml_mp3'];
}
if($bs_row['psl_file_type']=='MP4'){
$f = $mml_data['mml_mp4'];
}
$ex_p = explode('?',$f);
$path = "public_html/upload/music_mp3/".$ex_p[0];
$this->zip->read_file($path);
$d_type = 1;
}else{
$d_type = 0;
}
}
}
foreach($bal_data as $ba_row){
$dateA = $ba_row['bal_created'];
// your second date coming from a mysql database (date fields)
date_default_timezone_set('Asia/Kolkata');
$dateB = date("Y-m-d H:i:s");
$timediff = strtotime($dateB) - strtotime($dateA);
// if($timediff > 10800){ //echo 'more than 3 hours';
if($timediff > 86400){ //echo 'more than 24 hours';
$this->db->where('bal_mal_id',$ba_row['bal_mal_id'])
->set('bal_status','1')
->update('buy_album_list');
$d_type = 0;
}
else{
if($ba_row['bal_status']=='0'){
$mal_mml_data = $this->public_model->get_result_array_with_one_where('music_mp3_list','mml_mal_id',$ba_row['bal_mal_id']);
foreach($mal_mml_data as $re_row){
if($ba_row['bal_file_type']=='MP3'){
$f = $re_row['mml_mp3'];
}
if($ba_row['bal_file_type']=='MP4'){
$f = $re_row['mml_mp4'];
}
if($ba_row['bal_file_type']=='full_album'){
$f = $re_row['mml_mp3'];
}
$ex_p = explode('?',$f);
$path = "public_html/upload/music_mp3/".$ex_p[0];
$this->zip->read_file($path);
$d_type = 1;
}
}else{
$d_type = 0;
}
}
}
if($d_type=='1'){
ob_end_clean();
$zip_f_name = 'gravity_'.date('Y_m_d_His').'.zip';
$this->zip->download($zip_f_name);
}else{
$data['waring_msg'] = 'Sorry this file already downloaded.';
$this->load->view('paypal_status',$data);
}
}
还使用了先前问题中的函数 ob_end_clean(); ,但问题仍然存在
答案 0 :(得分:0)
托管提供程序限制了可生成文件的大小。