13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

444 Chapter 19 Interacting with the File System <strong>and</strong> the Server<br />

Getting File Information<br />

You can alter the part of the directory browsing script that reads files as follows:<br />

while(false !== ($file = readdir($dir))) {<br />

echo ‘’.$file.’’;<br />

}<br />

You can then create the script filedetails.php to provide further information about a<br />

file.The contents of this file are shown in Listing 19.6.<br />

One warning about this script: Some of the functions used here are not supported<br />

under Windows, including posix_getpwuid(), fileowner(), <strong>and</strong> filegroup(),orare<br />

not supported reliably.<br />

Listing 19.6<br />

filedetails.php—File Status Functions <strong>and</strong> Their Results<br />

<br />

<br />

File Details<br />

<br />

<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!