Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> problemy z download
swiety
post
Post #1





Grupa: Zarejestrowani
Postów: 44
Pomógł: 0
Dołączył: 23.03.2005

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


hej, mam nastepujacy problem, chce udostepnic pliki do sciagania i uzywam do tego reafile(), wszyskto niby chodzi ale np. sciagnieciu pliku jpg, albo exe nie daja sie one otworzyc, ale np. jak sciagam pliki pdf to wszystko chula, moze ktos zna jakies wyjscie tu przyklad kodu

  1. <?php
  2. $id=$_REQUEST['ID'];
  3.  
  4. $database->setQuery("SELECT file_path, file_name FROM #__tryouts_files WHERE id = $id");
  5. $file = $database->loadObjectList();
  6.  
  7. header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  8. header("Content-type: application/octet-stream");
  9. header('Content-Length: ' . filesize($file[0]->file_name));
  10. header('Content-Disposition: attachment; filename="' . basename($file[0]->file_name) . '"');
  11. readfile($file[0]->file_path);
  12. ?>

dzieki za wszelka pomoc, pozdro
Go to the top of the page
+Quote Post

Posty w temacie


Closed TopicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 16:06