Blog Home | Fife Visits Blog | Fife Rant Blog | Random Computing Stuff Index

Investigating PHP

I am currently working my way through MySQL for Dynamic Websites by Larry Ullman (edition 4).
I currently (December 2012) run php 5.3.10-10 and a mysql 5.1.28 database on apache 2.2.22 server on Ubuntu 12.04 in VirtualBox.

Chapter 11: Review and Pursue

show_file.php: Dec 2012

The php script in the pdf below is my take on part of the 3rd exercise in Chapter 11 PHP and MYSQL for Dynamic Web Sites (ed4) by Larry Ullman.
This script displays the file chosen from the list of links displayed in the "files.php" page.
The original script uses the "getimagesize" php function to obtain the MIME information, but to get the MIME type of other file types, I have used "finfo" variants (see the php.net site).
As a test, I inserted some file types into the "uploads" directory whose MIME types are not recognised by the script. This displays the default image/message.

If the pdf doesn't open, go to show_file.pdf