Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> PHP/PDF - jak zmusic IE do zapisu!
devuriel
post
Post #1





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 29.05.2009

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


Dzien dobry,

chcialem zmusic IE do pobierania pliku .PDF, nie odczytywania go bezposrednio w swoim oknie w tym celu uzylem nastepujacego kodu:
  1. <?php
  2.    header('Content-type: application/pdf');
  3.    header('Content-Disposition: attachment; filename="oferta/filtr.pdf"');
  4.    readfile('oferta/filtr.pdf');
  5. ?>

waga pliku jest dosc spora dlatego musialem uciekac sie do takich 'sztuczek'. Jednak nie dziala to jak chce.
Plik sie sciaga ale po otworzeniu nie ma prawidlowej zawartosci pliku. Co moze byc przyczyna? Czy sa inne rozwiazania?

Ten post edytował devuriel 29.05.2009, 09:55:49
Go to the top of the page
+Quote Post
nexis
post
Post #2





Grupa: Zarejestrowani
Postów: 1 012
Pomógł: 109
Dołączył: 26.09.2003
Skąd: nexis.pl

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


Nazwa pliku na pewno nie może być katalogiem:

  1. <?php
  2. header('Content-type: application/pdf');
  3. header('Content-Disposition: attachment; filename="filtr.pdf"');
  4. readfile('oferta/filtr.pdf');
  5. ?>
Go to the top of the page
+Quote Post
devuriel
post
Post #3





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 29.05.2009

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


Cytat
<br />
<b>Warning</b>: readfile(/oferta/filtr.pdf) [<a href='function.readfile'>function.readfile</a>]: failed to open stream: No such file or directory in <b>/var/www/ff/download.php</b> on line <b>4</b><br />


Ten post edytował devuriel 29.05.2009, 12:47:38
Go to the top of the page
+Quote Post
nospor
post
Post #4





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




cos ty namieszal? nexis zmienil ci tylko filename, a ty w readfile ponanosiles zmiany... no porownaj jego kod z twoim starym i zobacz drobną roznice
Go to the top of the page
+Quote Post
devuriel
post
Post #5





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 29.05.2009

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


Ach! Dziekuje nosper i nexis! Nawal pracy sprawil, ze nie moglem sie temu przygladnac. Faktycznie wstawilem shash'a / readfile().
EOT!
Go to the top of the page
+Quote Post

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: 3.10.2025 - 15:18