简体   繁体   English

访问 htdocs 文件夹外的 html 文件/视频文件

[英]Access html files / video files outside htdocs folder

Trying to protect video files that are done in camtsia which outputs html/with flash embed video files.试图保护在输出 html/flash 嵌入视频文件的 camtsia 中完成的视频文件。

Not sure how I would access them using PHP.不知道如何使用 PHP 访问它们。 I've searched stackoverflow and found using alias would be an option?我搜索了stackoverflow,发现使用别名是一种选择? Is that still secure though?那仍然安全吗? Is that the best way to go?这是 go 的最佳方式吗? Or should I try to purue a file open operations using PHP.或者我应该尝试使用 PHP 进行文件打开操作。

It needs to serve an html page which has.js.swf files along in the same protected dir.它需要提供一个 html 页面,该页面在同一受保护的目录中具有 .js.swf 文件。

Any help or direction is appreciated.任何帮助或方向表示赞赏。

You would use readfile to access the file and the header function to forge the content.您将使用 readfile 访问该文件并使用 header function 来伪造内容。 Make sure the www-data user, which is the Apache user and PHP uses it to access the filsystem, has permission on that folder.确保 www-data 用户,即 Apache 用户和 PHP 使用它来访问 filsystem,对该文件夹具有权限。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM