Пример #1
0
Файл: image.php Проект: rjha/sc
function check_image_name($name)
{
    $allowed = array("jpg", "jpeg", "png", "gif");
    $extension = Util::getFileExtension($name);
    if (!empty($extension)) {
        $extension = strtolower($extension);
    }
    if (empty($extension) || !in_array($extension, $allowed)) {
        $message = sprintf("error uploading %s : only JPG, JPEG, GIF, or PNG allowed", $name);
        $data = array("code" => 500, "error" => $message);
        echo json_encode($data);
        exit;
    }
}