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 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. 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 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. 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
Archived
This topic is now archived and is closed to further replies.