Reputation: 588
$myFile = "folder1/folder2/order.txt";
$fh = fopen($myFile, 'a');fwrite($fh, $Message);
fclose($fh);
I am use this code.But file is not create in that particular folder
Upvotes: 0
Views: 75
Reputation: 4750
Try this:
<?php
$myFile = "folder1/folder2/order.txt";
$fh = fopen($myFile, 'a'); or die("Unable to open the file");
fwrite($fh, $Message);
fclose($fh);
?>
If this code shows "Unable to open the file" that means there is something wrong while opening the file. This may happen if the folder1/folder2
doesn't exist. Or may be you are not permitted to open a file to write on that folder. If you are in Linux
you can change the permission of you directory like this:
chmod 777 folder/folder2
Upvotes: 1