Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] 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, uzywam do tego celu funkcji readfile(), wszystko niby gra, pliki sie sciagaja, ale np jpg, albo exe po sciagnieciu nie daja sie otworzyc, kiedy sciagam plik pdf to wszystko jest ok, tutaj moj cod:
  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. header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  7. header("Content-type: application/octet-stream");
  8. header('Content-Length: ' . filesize($file[0]->file_name));
  9. header('Content-Disposition: attachment; filename="' . basename($file[0]->file_name) . '"');
  10. readfile($file[0]->file_path);
  11. exit();
  12. //include("down_file.php");
  13. ?>

z gory dzieki za kazda pomoc, (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif)
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 23.08.2025 - 14:23