This is only the Error Processing portion of an uploading script.

It includes
"No File Selected"
"Unsupported File Type"
"File size is above limit"
Type errors.

It uses an Array for allowed file extensions, checks the extension using pathinfo on the upload file, Size is set by Megabytes (Then calculated into bytes :P)

all errors are in an Array, called "Errors" which is echoed out in an Unordered List at the very bottom of the page.

Some Commented code for Display All allowed files.

uses the variable "Processed" to check weather or not the file clears all required attrubites.

Minium Comments explaining some stuff.

HTML
Code:
<html>
<body>
<form action="" method="POST" enctype="multipart/form-data">

    File:
    <input type="file" name="file_uploader">
    <input type="submit" value="Upload">

</form>
</body>
</html>
PHP (Place Above/Below HTML, Your choice, Both Work.)
PHP Code:
     <?php
    
//Defining some Variables for Error Checking.
    
    //Set File Size
    
$max "1";
    
$max = (($max 1024)*1024);

    
//Allowed File Types
    
$extensions = array("dem""png""jpg");

    
//Do not Edit Belo this Comment (:
    //Grabbing File Extension
    
$file $_FILES['file_uploader']['name'];
    
$ext pathinfo($filePATHINFO_EXTENSION);

    
//Other Stuffs :D    
    
$size $_FILES['file_uploader']['size'];
    
$processed false;
    
$errors[] = false;
    unset(
$errors[0]);
    
    
//Some Basic Error Checking

    
if(!isset($_FILES['file_uploader']['tmp_name'])){
        
$errors[] = "No File Selected";
    } else {
        if(!
in_array($ext$extensions)){
            
$errors[] = "Unsupported File Type.";
        } else {
            if(
$size $max){
                
$max = (($max/1024)/1024);
                
$errors[] = "File size is to large, max file size is {$max}Mb(s)";
            } else {
                
$processed true;
            }
        }
    }

    
//If nothing came back as an error, continue with basic file processing and
    //Any MySQL Database information.

    
if($processed){
        echo 
"No Errors. Please Continue.";
    }

    
//Process all and any Errors.
    
if($errors){
        echo 
"<ul>";
        foreach(
$errors as $error){
            echo 
"<li>{$error}</li>";
        }
        echo 
"</ul>";
    }

    
//Testing Section, all Tests will be commented in the code for your enjoyment

    //Code to display all avaiable Extensions(Cleanly echo out the $extensions
    //Array, with a . before all exts.)
    // for($i=0; $i<count($extensions); $i++){
    //     echo '.'.$extensions[$i].' ';
    // }
?>
If anyone wants to create the processing portion of this, go ahead (:

If theres a part that you dont understand, post a comment, i'll get back ASAP.