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
Not able to create textFile in server using php - urgent
Moderator: General Moderators
-
sujithks81
- Forum Newbie
- Posts: 2
- Joined: Sun Jul 24, 2011 5:21 am
-
internet-solution
- Forum Contributor
- Posts: 220
- Joined: Thu May 27, 2010 6:27 am
- Location: UK
Re: Not able to create textFile in server using php - urgent
Have you given the web server write permission to the the folder on the server?
-
sujithks81
- Forum Newbie
- Posts: 2
- Joined: Sun Jul 24, 2011 5:21 am
Re: Not able to create textFile in server using php - urgent
I given like chmod 777 * in that folder.
Is this you mentioned?If not plz guide?
Is this you mentioned?If not plz guide?
Re: Not able to create textFile in server using php - urgent
Insert the following at the top of your PHP code:
Code: Select all
ini_set("display_errors",1);
ERROR_REPORTING(E_ALL);