Access html files / video files outside htdocs folder

前端 未结 1 837
甜味超标
甜味超标 2021-01-28 12:23

Trying to protect video files that are done in camtsia which outputs html/with flash embed video files.

Not sure how I would access them using PHP. I\'ve searched stacko

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-28 13:00

    You would use readfile to access the file and the header function to forge the content. Make sure the www-data user, which is the Apache user and PHP uses it to access the filsystem, has permission on that folder.

    header('Content-type: video/avi');
    header('Content-Disposition: attachment; filename="videodownload.avi"');
    readfile('/var/videos/myvideo.avi');
    

    0 讨论(0)
提交回复
热议问题