Bilo na forumu, al bas sam danas radio nesto ovako, pa evo ti svez deo koda.
Code:
$file = $folderLocation . $fileName; // this location variable
//$type = 'application/octet-stream';
$type = mime_content_type($file);
$size = filesize($file);
header("Content-type: " . $type);
header("Pragma: no-cache");
header("Content-Length: " . $size);
if ($forceDownload) {
header("Content-Disposition: attachment; filename=" . basename($file)); //will always force download
}
//
header("Content-Transfer-Encoding: binary");
header("Cache-control: private");
readfile($file); function that actually displays the file
I samo negde na pocetku fajla pitas da li je korisnik logovan (znas vec u tvojoj aplikaciji kako to da proveris) i da li ima pristup fajlu (takodje, zavisi kako definises nivo pristupa).
Snaci ces se vec sta cemu sluzi