Create a file
Moderator: General Moderators
- moiseszaragoza
- Forum Commoner
- Posts: 87
- Joined: Sun Oct 03, 2004 4:04 pm
- Location: Ft lauderdale
- Contact:
Create a file
I eas wandering if any one knew what is the comad that i can create a new text file from a online interface
check out this http://us3.php.net/manual/en/function.fopen.php
- akimm
- Forum Contributor
- Posts: 460
- Joined: Thu Apr 27, 2006 10:50 am
- Location: Ypsilanti Michigan, formally Clipsburgh
and if you can't figure that out.
remember this
remember this
Code: Select all
#create handle
$fp = fopen('youfile.txt', 'w'); //'w' specifies that you want to create it if its not created.
//If the textfile for which you choose to write is created use 'a' which means append to the end of a file.
$write_string = "it works!"; //contents you chose to write.
if($fp) {
fwrite($fp, $write_string); //write_string can be any variable, I just chose it for this example.
} else {
die(); // instructs the file to stop if something goes wrong.
}- moiseszaragoza
- Forum Commoner
- Posts: 87
- Joined: Sun Oct 03, 2004 4:04 pm
- Location: Ft lauderdale
- Contact:
- moiseszaragoza
- Forum Commoner
- Posts: 87
- Joined: Sun Oct 03, 2004 4:04 pm
- Location: Ft lauderdale
- Contact:
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Make sure you use the right fopen() flags (like 'w') for the right scenario...
Windows systems require an additional flag at times, usually "t". See the description under the flag listing in the manual.
Windows systems require an additional flag at times, usually "t". See the description under the flag listing in the manual.