Whenever I run some code in PHP, I get these warnings:
Warning: fopen(extfiles/
Notice: Undefined offset: 1 in C:\filepath\file.java): failed to open stream: Invalid argument in C:\filepath\file.php on line 82 Warning: feof() expects parameter 1 to be resource, boolean given in C:\filepath\file.php on line 84
Warning: fgets() expects parameter 1 to be resource, boolean given in C:\filepath\file.php on line 87
The lines from the code:
$filenamee = $_POST["filename"];
$folder = $_POST["folder"];
$var1 = explode(".", $filenamee);
$var2 = explode(".", $folder);
$filename = "extfiles/".$var2[0]."/".$var1[0].".java";
$file = fopen($filename, "c"); // This is line 82
$lines_array = array();
while (!feof($file)) { // This is line 84
$line = fgets($file); // This is line 87
array_push($lines_array, $line);
}
The code needs to create and edit Java file, but the problem is that it isn't creating it. Whenever I run this code, I get the last 2 warnings lots of times...
What can I do in order to solve it?