LinksTraffic - Links and traffic exchange system

Write to a file

english directory french directory
Search: Advanced Search

Write to a file

Copy and paste the following code into your editor and run it (code comments are included).

If you want to see the live result (we believe this is the best way to learn what is the script about), try it here (new window).

Source code

The writefile.html file (online form)

download the file

The writefile.php file

The page where we output the entered content to a file.

download the file

From the page http://www.php.net...fopen.php you can learn about the following features:

A list of possible modes for fopen() using mode:

modeDescription
'r'Open for reading only; place the file pointer at the beginning of the file.
'r+'Open for reading and writing; place the file pointer at the beginning of the file.
'w'Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
'w+'Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
'a'Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
'a+'Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
'x'Create and open for writing only; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. This option is supported in PHP 4.3.2 and later, and only works for local files.
'x+'Create and open for reading and writing; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. This option is supported in PHP 4.3.2 and later, and only works for local files.

Post a comment

Webmaster Corner

The ClickBnk Code
Another Killer Product From Michael Jones, simply follow the Blueprint For Easy Online Wealth Using Click Bank...

Mass Article Control #1
Create Thousands Of Articles From only 1 Article and Have them Submitted Automatically With A brand New Submitter!

iPowerWeb
Incredible Membership Packages - Web Hosting!

Maverick Money Makers - Get Paid For Life!

Categories

Copyright 2004-2010 @ LinksTraffic RHM Solution ::: Partners | Privacy | Contact us form