34,333
edits
Changes
m
→Moving, Copying and Deleting Files with PHP
?>
</pre>
== Accessing File Attributes ==
PHP provides access to a wide range of file attributes such as when the file was created, whether the file is readable or writeable and the current file size.
The PHP ''stat()'' and ''fstat()'' functions provide a wealth of information about a file. The information is so copious that the results are returned as an associative array. The function take a single argument. ''stat()'' takes a string definingthe poath to the file. ''fstat()'' takes a file handle returned from an ''fopen()'' function call.
The following table outlines the array values returned by both functions:
<table border="1" cellspacing="0" width="100%">
<tr style="background:#efefef;">
<th>Key<th>Description</th>
<tr>
<td>dev<td>Device number</td>
<tr>
<td>ino<td>Inode number</td>
<tr>
<td>mode<td>Inode protection mode</td>
<tr>
<td>nlink<td>Number of links</td>
<tr>
<td>uid<td>User ID of owner</td>
<tr>
<td>gid<td>Group ID of owner</td>
<tr>
<td>rdev<td>Inode device type</td>
<tr>
<td>size<td>Size in bytes</td>
<tr>
<td>atime<td>Last access (Unix timestamp)</td>
<tr>
<td>mtime<td>Last modified (Unix timestamp)</td>
<tr>
<td>ctime<td>Last inode change (Unix timestamp)</td>
<tr>
<td>blksize<td>Blocksize of filesystem IO (platform dependent)</td>
<tr>
<td>blocks<td>Number of blocks allocated</td>
</table>