<?php
if (isset($row['plik']) && !empty($row['plik'])) { $path = "cms/"; // change the path to fit your websites document structure
$fullPath = $path.$sFileName;
if ($fd = fopen ($fullPath, "r")) { header("Content-type: application/octet-stream"); header("Content-Disposition: filename=\"".$path_parts["basename"]."\""); header("Content-length: $fsize"); header("Cache-control: private"); //use this to open files directly $buffer = fread($fd, 2048
); }
}
}}
// laczenie z baza danych
require("pliki/laczenie.php");
// zapytanie pobierajace dane z bazy danych
{
Opis: %s<br/>
Plik: %s<br/>
Rozmiar: %s kb<br/>
Ilość pobrań: %s
<br/>
<a href='listaplikow.php?$row[plik]'>Pobierz</a>
", $row[id], $row[opis],$row[plik],$row[rozmiar],$row[ilosc_pobran]);
}
// zamykanie polaczenie
?>
Teraz tak wyglada , ale wogole nie czyta tego kawalku kodu na samej gorze , bo jak klikam pobierz to fail .
Jeszcze probowalem stawic ten kawalek kodu z poczatku po linii 32 ale mam bledy , ze musi byc na poczatku.
Tutaj kolejna wersja nie dzialajaca , tu juz probowalem zrobic , zeby pliki byly w glownym ale i tak fail.
<?php
// laczenie z baza danych
require("pliki/laczenie.php");
if (isset($_GET['plik']) && !empty($_GET['plik'])) { $sFolder = './';
$fullPath = $sFolder.$sFileName;
if ($fd = fopen ($fullPath, "r")) { header("Content-type: application/octet-stream"); header("Content-Disposition: filename=\"".$path_parts["basename"]."\""); header("Content-length: $fsize"); header("Cache-control: private"); //use this to open files directly $buffer = fread($fd, 2048
); }
}
}
}
// zapytanie pobierajace dane z bazy danych
{
// laczenie z baza danych
require("pliki/laczenie.php");
if (isset($_GET['plik']) && !empty($_GET['plik'])) { $sFolder = './';
$fullPath = $sFolder.$sFileName;
if ($fd = fopen ($fullPath, "r")) { header("Content-type: application/octet-stream"); header("Content-Disposition: filename=\"".$path_parts["basename"]."\""); header("Content-length: $fsize"); header("Cache-control: private"); //use this to open files directly $buffer = fread($fd, 2048
); }
}
}
}
Opis: %s<br/>
Plik: %s<br/>
Rozmiar: %s kb<br/>
Ilość pobrań: %s
<br/>
<a href='pliki/listaplikow.php?$row[plik]'>pobierz</a>
", $row[id], $row[opis],$row[plik],$row[rozmiar],$row[ilosc_pobran]);
}
// zamykanie polaczenie
?>
help