2013-03-07 66 views
-5

當我從服務器下載文件時,它不給予恢復支持。PHP下載恢復支持問題

下面是代碼:

if ($zc['mm'] && $zc['mm_down'] && preg_match('/\.('.$zc['mm_ext'].')$/i', $path, $exts)) { 
    $file = $zc['mp3_dir'].'/'.$path; 
    if (file_exists($file)) { 
     if ($zc['stream_int']) { 
      $ext = strtolower($exts[1]); 
      zina_set_header('Content-Type: '.$zc['mm_types'][$ext]['mime']); 
      $disposition = (isset($zc['mm_types'][$ext]['disposition'])) ? $zc['mm_types'][$ext]['disposition'] : 'attachment'; 
      zina_set_header('Content-Disposition: '.$disposition.'; filename="'.basename($path).'"'); 
      zina_set_header('Content-Length: '.filesize($file)); 
      zina_set_header('Cache-control: public'); #IE seems to need this. 
      zina_set_header("Content-Transfer-Encoding: binary\n"); 
      zina_set_header('Content-Type: $contentType'); 
      zina_send_file($file); 
     } 
     else { 
      zina_goto($path,NULL,NULL,TRUE,TRUE); 
     } 
    } 
} 

有人能幫助我如何使這個代碼簡歷可支持的。

在此先感謝。

+0

你真的認爲全大寫的標題是合適的嗎?!除此之外,你真的需要縮進你的代碼... – ThiefMaster 2013-03-07 16:34:58

+0

你需要處理Range頭。除非你表明你試圖解決問題,否則你在這裏得不到多少幫助。 – datasage 2013-03-07 16:37:24

回答

1

自行添加簡歷支持相當複雜 - 您需要檢查的Range頭文件不僅支持簡單的範圍,而且還支持相當複雜的範圍。

唯一真正簡單和乾淨的解決方案是使用諸如標頭(Lighttpd的本機支持,module可用於Apache)的東西,它告訴您的Web服務器向用戶發送某個文件。恢復,並行下載等在這種情況下將正常工作。

+0

感謝您的快速響應。我在IIS中託管此網站。 IIS在其他靜態網站上提供簡歷支持,但不在此網站上。需要幫忙! – user2145137 2013-03-07 16:47:33