12-20-2007, 02:15 AM
|
#2 (permalink)
|
|
The Acquainted
Join Date: Sep 2007
Location: Arizona
Posts: 114
Thanks: 10
|
What are you trying to accomplish with the following?
PHP Code:
$handler == $handler.".JPG"; $handler == $handler.".PNG"; $handler == $handler.".GIF"; $handler == $handler.".BMP";
If you are trying to do what I think you are doing, this should suffice.
PHP Code:
function isImage($handler) { /* Make the string all lowercase */ $handler = strtolower($handler); /* Get the extension */ $extension = explode('.', $handler); $extension = array_splice($extension, -1, 1); /* Check if filetype is allowed */ if ($extension[0] == 'jpg' || $extension[0] == 'png' || $extension[0] == 'gif' || $extension[0] == 'bmp') { /* Check if the file exists */ if (file_exists($handler)) { echo 'File exists.'; } else { echo 'File does not exist.'; } } else { echo 'Unknown file type.'; } }
|
|
|