neugi Posted June 30, 2006 Share Posted June 30, 2006 Hi, i want to create a file on the server.i know how to write into a file, but i cant remember how to create a file with php where i can write inside. thx Quote Link to comment https://forums.phpfreaks.com/topic/13317-how-to-create-a-file-on-the-server/ Share on other sites More sharing options...
technode Posted June 30, 2006 Share Posted June 30, 2006 if the file already exists, resaving will overwrite what is there. Otherwise, open the file, dump he data into a variable and add the new information to the end and resave. Quote Link to comment https://forums.phpfreaks.com/topic/13317-how-to-create-a-file-on-the-server/#findComment-51362 Share on other sites More sharing options...
neugi Posted June 30, 2006 Author Share Posted June 30, 2006 Hi, i need to create a new file. there is no existing file where i can write into ;)best Quote Link to comment https://forums.phpfreaks.com/topic/13317-how-to-create-a-file-on-the-server/#findComment-51364 Share on other sites More sharing options...
Orio Posted June 30, 2006 Share Posted June 30, 2006 It may sound confusing, but fopen() is used to create files.if you write:fopen("something.txt","w");And something.txt doesnt exsist, it'll try to create it.Note that the file will be created only using the modes w, w+, a and a+.For more information, check [url=http://www.php.net/manual/en/function.fopen.php]fopen()[/url]Orio. Quote Link to comment https://forums.phpfreaks.com/topic/13317-how-to-create-a-file-on-the-server/#findComment-51387 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.