Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Fopen a readfile
tabbi
post
Post #1





Grupa: Zarejestrowani
Postów: 150
Pomógł: 3
Dołączył: 30.10.2010

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


Witam,

jak jest zasadnicza różnica pomiędzy tymi dwoma kodami:

  1. $fp = fopen($fileLink, 'r') or die ("404");
  2. header("Pragma: no-cache");
  3. header("Content-Type: application/x-unknown");
  4. header("Expires: 0");
  5. header("Content-Length: ".$file['size']);
  6. header("Content-Transfer-Encoding: binary");
  7. @header('Content-Disposition: attachment; filename="'.$file['filename'].'"');
  8. if(!fp) exit; // if $fp is not a valid stream resource, exit
  9. fseek($fp,$byte_from);
  10. while(!feof($fp)){
  11. //reset time limit for big files
  12. print(fread($fp,1024*8));
  13. flush();
  14. }
  15. fpassthru($fp);
  16. fclose($fp);


a

  1. header("Pragma: no-cache");
  2. header("Content-Type: application/x-unknown");
  3. header("Expires: 0");
  4. header("Content-Length: ".$file['size']);
  5. header("Content-Transfer-Encoding: binary");
  6. flush();
  7. readfile($fileLink);


Interesuje mnie ściąganie dużych plików na serwer i wydajność w obciążeniu ? Byłbym wdzięczny na nakreślenie kilku uwag
Go to the top of the page
+Quote Post

Posty w temacie


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 Aktualny czas: 20.08.2025 - 18:57