Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Problem ze skryptem pobierania plików
czernin
post
Post #1





Grupa: Zarejestrowani
Postów: 62
Pomógł: 0
Dołączył: 14.06.2012

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


Witam,

Mam taki skrypt, który pobiera na dysk użytkownika plik.

  1. <?php
  2.  
  3. header("Content-type: application/octet-stream");
  4. header("Content-Length: " . filesize('001.jpg'));
  5. header('Content-Disposition: attachment; filename="001.jpg"');
  6. readfile('001.jpg');
  7.  
  8. ?>


Wprawdzie plik ten się pobiera, ale nie można go otworzyć na komputerze. Przeglądarka fotografii Windows pokazuje, że nie może otworzyć tego obrazu, bo nie obsługuje tego formatu pliku. Co jest nie tak w tym skrypcie, jak go przerobić?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
webdice
post
Post #2


Developer


Grupa: Moderatorzy
Postów: 3 045
Pomógł: 290
Dołączył: 20.01.2007




  1. header( 'Content-type: image/jpeg' );
  2. header( 'Content-Disposition: attachment; filename="file.jpg"' );
  3.  
  4. readfile( 'file.jpg' );


Upewnij się że ścieżka do pliku jest dobra.
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: 23.08.2025 - 11:27