$fh = fopen('c:/images/logo.gif','rb');
To operate on a file, pass the file handle returned from
fopen( ) to other I/O functions such as
fgets( ), fputs( ), and
fclose( ).
If the file given to fopen( )
doesn't have a pathname, the file is opened in the
directory of the running script (web context) or in the current
directory (command-line context).
You can also tell fopen( ) to search for the file
to open in the include_path specified in your
php.ini file by passing 1 as a third argument.
For example, this searches for file.inc in the
include_path:
$fh = fopen('file.inc','r',1) or die("can't open file.inc: $php_errormsg");