I am developeing a online video selling website in PHP. To download the specific video user pay perticular amount, then i provide a link to download video. I used following code to provide a download link to user.
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
I have stored all the videos in a particular folder. How can I prevent user to prevent user so that they can not look through that video folder and can not download videos for free. or can not grab website and download all content.