View Single Post
Old 12-20-2007, 02:15 AM   #2 (permalink)
Andrew
The Acquainted
 
Join Date: Sep 2007
Location: Arizona
Posts: 114
Thanks: 10
Andrew is on a distinguished road
Default

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, -11);
    
/* 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.';
    }

Send a message via AIM to Andrew Send a message via MSN to Andrew
Andrew is offline  
Reply With Quote
The Following User Says Thank You to Andrew For This Useful Post:
Orc (12-20-2007)