S
sweta agarwal
Guest
hi ! i am trying to create file using the following code in php but i am not able to create file.can anyone please help me to fix the problem so that i can get out of it:
the code is:
<?php
$file_name="/home/abc.crt";
if(file_exists($file_name))
{
echo ("$file_name does exsist");
}
else
{
echo ("$file_name does'nt exsist");
touch ($file_name);//create the file if it doesn't exist
}
?>
How to create a file .any alternate method :
even i have tried with the following code but still strucked.:
<?php
$fh = fopen(" myfile.txt", "w+");
if($fh==false)
die("unable to create file");
?>
output is:
unable to create file.
the code is:
<?php
$file_name="/home/abc.crt";
if(file_exists($file_name))
{
echo ("$file_name does exsist");
}
else
{
echo ("$file_name does'nt exsist");
touch ($file_name);//create the file if it doesn't exist
}
?>
How to create a file .any alternate method :
even i have tried with the following code but still strucked.:
<?php
$fh = fopen(" myfile.txt", "w+");
if($fh==false)
die("unable to create file");
?>
output is:
unable to create file.