Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl


mroczek
Napisane: 10.10.2008, 18:20:13





Grupa: Zarejestrowani
Postów: 18
Dołączył: 13.03.2007

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

Czytałeś to? PHP forum
  Forum: Przedszkole · Podgląd postu: #524946 · Odpowiedzi: 3 · Wyświetleń: 1 278

mroczek
Napisane: 11.08.2008, 21:09:45





Grupa: Zarejestrowani
Postów: 18
Dołączył: 13.03.2007

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

  1. <?php
  2. // downloading a file
  3. $filename = 'http://www.tnx.nl/php.jpg';
  4.  
  5. // fix for IE catching or PHP bug issue
  6. header("Pragma: public");
  7. header("Expires: 0"); // set expiration time
  8. header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  9. // browser must download file from server instead of cache
  10.  
  11. // force download dialog
  12. header("Content-Type: application/force-download");
  13. header("Content-Type: application/octet-stream");
  14. header("Content-Type: application/download");
  15.  
  16. // use the Content-Disposition header to supply a recommended filename and
  17. // force the browser to display the save dialog.
  18. header("Content-Disposition: attachment; filename=".basename($filename).";");
  19.  
  20. /*
  21. The Content-transfer-encoding header should be binary, since the file will be read
  22. directly from the disk and the raw bytes passed to the downloading computer.
  23. The Content-length header is useful to set for downloads. The browser will be able to
  24. show a progress meter as a file downloads. The content-lenght can be determines by
  25. filesize function returns the size of a file.
  26. */
  27. header("Content-Transfer-Encoding: binary");
  28. header("Content-Length: ".filesize($filename));
  29.  
  30. @readfile($filename);
  31. exit(0);
  32. ?>


Wystarczy wstawić link do pliku w zmiennej $filename. Wszystko co jest potrzebne znajdziesz w php.net. Szukałeś?
  Forum: PHP · Podgląd postu: #504000 · Odpowiedzi: 4 · Wyświetleń: 1 085

mroczek
Napisane: 4.08.2008, 21:39:00





Grupa: Zarejestrowani
Postów: 18
Dołączył: 13.03.2007

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

Najlepiej wyłączyć safe_mode albo poczytać trochę o ustawieniu safe_mode_exec_dir.
  Forum: Przedszkole · Podgląd postu: #501279 · Odpowiedzi: 15 · Wyświetleń: 2 482

mroczek
Napisane: 4.08.2008, 19:34:33





Grupa: Zarejestrowani
Postów: 18
Dołączył: 13.03.2007

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

No i oczywiście pozostaje wspaniała zabawa uprawnieniami dostępu winksmiley.jpg
  Forum: Przedszkole · Podgląd postu: #501209 · Odpowiedzi: 15 · Wyświetleń: 2 482


New Posts  Nowe odpowiedzi
No New Posts  Brak nowych odpowiedzi
Hot topic  Popularny temat (Nowe)
No new  Popularny temat (Brak nowych)
Poll  Sonda (Nowe)
No new votes  Sonda (Brak nowych)
Closed  Zamknięty temat
Moved  Przeniesiony temat
 

RSS Wersja Lo-Fi Aktualny czas: 9.05.2024 - 04:47