1

I want to create a simple app using PHP for uploading videos. But, I want to make sure it is not accessible for download but can be embedded in my app so I can play it. How can I do this?

It was inspired with this question php restrict access to files in directory but I really don't get how it works.

Community
  • 1
  • 1
  • This [answer in the question](http://stackoverflow.com/a/19645606/1450077) you liked to explains it quite well. Basically, enable PHP to access them via a user permission, but place the files outside your document root - so that users cannot access them via a link. – Fluffeh Sep 21 '14 at 08:30

1 Answers1

1

You can just do it by storing data outside the public DocumentRoot and using PHP to deliver the file.

But i would recommend you to use .htaccess file for this purpose.

You can do it with .htaccess file like

deny from all

Please have a look here too.I think this is what you've wanted.

Community
  • 1
  • 1
Avinash Babu
  • 6,171
  • 3
  • 21
  • 26
  • but, can my app access it for playing purposes of the video? –  Sep 21 '14 at 08:32
  • btw, how can i directly link to that file if it is outside the document root folder? so i can embed it inside my app –  Sep 21 '14 at 08:45
  • for tht u would need to do some changes http://stackoverflow.com/questions/15182008/how-to-access-files-outside-the-documentroot-in-a-virtualhost-in-xampp – Avinash Babu Sep 21 '14 at 08:48