Filename like the user name

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ramya4myself
Forum Newbie
Posts: 7
Joined: Sat Nov 07, 2009 2:46 pm

Filename like the user name

Post by ramya4myself »

I am creating a form and storing the values in file. Could anyone please tell me how to write a code in php for creating a filename based on the user name as in the form.

Thanks
Ramya
Colwell
Forum Newbie
Posts: 6
Joined: Fri Nov 06, 2009 2:12 pm

Re: Filename like the user name

Post by Colwell »

Do you mean creating a new file or altering an existing file?
ramya4myself
Forum Newbie
Posts: 7
Joined: Sat Nov 07, 2009 2:46 pm

Re: Filename like the user name

Post by ramya4myself »

I want to create new file for every new user who fills the form but the file name should be in the user's name which the user enters.
ramya4myself
Forum Newbie
Posts: 7
Joined: Sat Nov 07, 2009 2:46 pm

Re: Filename like the user name

Post by ramya4myself »

Thanks.
It worked by using the code

Code: Select all

$file=$name;
But I want the filename in a particular directory like PHP/Peter.txt. This is not happening even though I set the permissions of the file and the directory. It displays an error "fopen cannot open directory: Is a directory /PHP/Peter.txt ". Could anyone please help me with this.
Post Reply