note 107106 deleted from function.fwrite by danbrown
| From: | danbrown@php.net | Date: | Mon, 09 Jan 2012 18:29:32 +0000 |
| Subject: | note 107106 deleted from function.fwrite by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-185485@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Hi,
I am trying to create file in a subdirectory called files.
I am trying this code:
<?php
$mypath="test";
mkdir($mypath,0777,TRUE);
$filename = $mypath.'\test.txt';
$handle = fopen($filename,"x+");
$somecontent = "Add this to the file Oktavianus";
fwrite($handle,$somecontent);
echo "Success";
fclose($handle);
?
it is creating directory test, but it is creating files in the directory test but in the root
directory where directory test is. Any how to save files in the subdirectory test?
Thanks