在主页上,我接受了文件输入,即
form action = "Results" method = "post"
input type = "file" name="file_name"
input type = "submit" value="Upload"
/form
在结果页面上,我编写了一个PHP代码来阅读其内容。
?php
$file = $_POST["file_name"];
$fp = fopen($file, 'r');
if($fp == NULL){
echo '<h2> File not found !!!</h2>';
}
else {
$line = fread($fp,filesize($file));
...
}
fclose($fp);
?
代码在XAMPP上完美运行但是当我尝试在我的网站上运行它时会显示此错误。
*Warning: fopen(004.txt) [function.fopen]: failed to open stream: No such file or directory in /home/u795370533/public_html/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 439 **File not found !!!***
*Warning: fclose() expects parameter 1 to be resource, boolean given in /home/u795370533/public_html/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 652*
我在我的网站上安装了exec-php插件,但我无法弄清楚错误。
答案 0 :(得分:0)
听起来像是
1) No any file was uploaded to the temp directory
2) You have to check the upload_max_filesize of your server. (run phpinfo() and check)
3) Just `print_r($_FILE)` to check what is the error?