i want to create a file inside another directory called "files".
My Server looks like this:
$myfile = fopen("../files/file2.txt", "w")or die("Unable to open file!");
Warning: fopen(../files/file2.txt): failed to open stream: No such file or directory in C:\xampp\htdocs\createfile.php on line 4
If the PHP file and the folder you want to create the file in exist in the same folder, there is no need for "../". The meaning currently is that files directory is at the same level as root directory. Just remove that and it should work.
$myfile = fopen("files/file2.txt", "w")or die("Unable to open file!");