It checks whether the file was uploaded via HTTP POST
Example
<?php
echo is_uploaded_file(‘test.txt’)?”Yes”:”No”;
?>
Output
No
It checks whether the file was uploaded via HTTP POST
Example
<?php
echo is_uploaded_file(‘test.txt’)?”Yes”:”No”;
?>
Output
No
It checks whether the file exists and is readable
Example
<?php
echo is_readable(‘test.txt’)?”Yes”:”No”;
?>
Output
Yes
It checks whether the filename is a symbolic link
Example
<?php
echo is_link(‘test.txt’)?”Yes”:”No”;
?>
Output
No
It checks whether the filename is a regular file
Example
<?php
echo is_file(‘test.txt’)?”Yes”:”No”;
?>
Output
Yes
It checks whether the filename is executable
Example
<?php
echo is_executable(‘test.txt’)?”Yes”:”No”;
?>
Output
Yes
It checks whether the filename is a directory
Example
<?php
echo is_dir(‘test.txt’)?”Yes”:”No”;
?>
Output
No
It writes the string to a file
Example
<?php
$fp = fopen(“test.txt”, “w”);
$data = fwrite($fp,”phpcodez” );
fclose($fp);
?>
It truncates a file to a given length
Example
<?php
$fp = fopen(“test.txt”, “r”);
ftruncate($fp,5);
?>
It returns the current position of the file pointer
Example
<?php
$fp = fopen(“test.txt”, “r”);
$data = fgets($fp, 5);
echo ftell($fp);
?>
Output
4
It returns information about a file using an open file pointer
Example
<?php
$fp = fopen(‘test.txt’, ‘r’);
$stats = fstat($fp);
echo “<pre>”;
print_r($stats);
?>
Output
Array
(
[0] => 2049
[1] => 673768
[2] => 33279
[3] => 1
[4] => 1000
[5] => 1000
[6] => 0
[7] => 8
[8] => 1336732795
[9] => 1336732794
[10] => 1336732794
[11] => 4096
[12] => 8
[dev] => 2049
[ino] => 673768
[mode] => 33279
[nlink] => 1
[uid] => 1000
[gid] => 1000
[rdev] => 0
[size] => 8
[atime] => 1336732795
[mtime] => 1336732794
[ctime] => 1336732794
[blksize] => 4096
[blocks] => 8
)