<gh_stars>0<?php

if (!preg_match('/\w{3,12}.\w{2,4}$/',$file)) {
    DIE("The filename should only contains between 3 to 8 letters");
}
if (preg_match('/\.php$/',$file)) {
    DIE("NO PHP!!");
}

if(!move_uploaded_file($_FILES['image']['tmp_name'], $dir . $file)) {
    die("Error during upload");
}

?>