Page 1 of 1

Not able to create textFile in server using php - urgent

Posted: Sun Jul 24, 2011 5:23 am
by sujithks81
Dear friends,
I am doing a php project. I want to create a text file in server from client and writr some data init using php.I used following code.
But it is not able to create the file.

$myFile = "test.txt";
$fh = fopen($myFile, 'w') or die("can't open file...");
$stringData = "New Stuff 1\n";
fwrite($fh, $stringData);
$stringData = "New Stuff 2\n";
fwrite($fh, $stringData);
fclose($fh);


Please share your valuable ideas and thought abt this.It is little urgent.
Thanks
Rakesh

Re: Not able to create textFile in server using php - urgent

Posted: Sun Jul 24, 2011 5:31 am
by internet-solution
Have you given the web server write permission to the the folder on the server?

Re: Not able to create textFile in server using php - urgent

Posted: Sun Jul 24, 2011 12:00 pm
by sujithks81
I given like chmod 777 * in that folder.
Is this you mentioned?If not plz guide?

Re: Not able to create textFile in server using php - urgent

Posted: Sun Jul 24, 2011 2:33 pm
by califdon
Insert the following at the top of your PHP code:

Code: Select all

ini_set("display_errors",1);
ERROR_REPORTING(E_ALL);