我认为这最终会成为一个问题而且我是一个完整的Linux菜鸟。我的文件夹结构如下:
var
+www
++AutoVerify3
+++ajax
+++php
+++results
++++index.php <--The file generating the error
+++users
++++jerred
+++++uploads
++++++combined.xml <--The file I'm trying to open
所以从上面的index.php文件中,我正在尝试打开combined.xml,我不断收到此错误:
Warning: file_get_contents(AutoVerify3/users/jerred/uploads/Combined.xml): failed to open stream: No such file or directory in /var/www/AutoVerify3/results/index.php
这是php代码:
$xmlFile = substr($_SERVER['PHP_SELF'],1,strpos($_SERVER['PHP_SELF'],"/",1)).'users'.DIRECTORY_SEPARATOR.''.$_SESSION['myusername'].DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.$_POST['batchFile'];
$xml = file_get_contents($xmlFile);
我尝试了几种不同的路径组合,但缺乏我的linux知识。
答案 0 :(得分:3)
存在太明显的风险,该文件是combined.xml(小写),但您包含Combined.xml(大写)。理智检查,请确认吗? :)