Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> dynamiczny link do archiwum zip, zla ustawione naglowki
idzik
post 29.05.2006, 14:27:47
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 29.05.2006

Ostrzeżenie: (0%)
-----


Witam.
Chce zrobic linki do archiwow zip.
Mam taki kod:
  1. <?php
  2.  
  3.  header("Pragma: public");  
  4.  header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  5.  header("Cache-control: private", false); 
  6.  header("Content-Transfer-Encoding: binary"); 
  7.  header('Content-Type: application/zip'); 
  8. header('Content-Disposition: attachment; filename='.basename($sZipFilePath).';');
  9.  
  10. $nChunkSize = 1*(1024*1024); // how many bytes per chunk
  11. $sBuffer = '';
  12. $rHandle = fopen($sZipFilePath, 'rb');  
  13. if (false === $rHandle) {
  14.  //.......... tu obsluguje blad
  15.  return true;
  16. }  
  17. while (!feof($rHandle)) {
  18. $sBuffer = fread($rHandle, $nChunkSize);
  19. print($sBuffer);
  20. flush();
  21. }
  22. fclose($rHandle);
  23.  
  24. // force break script execution
  25. exit();
  26. ?>

I niby plik sie sciaga, ale plik nie dziala pod winzipem i arkiem (w linuxie).
Jedynie winrar go otwiera.
Oto blad z winzipa:
"error[c:\plik.zip]: start of central directory not found; Zip file corrupt. Possible cause: file transfer error."
Czy moze mi ktos pomoc?
Pozdrawiam
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 07:58