Perchè scrivi file_exists(IMAGES_DIR) invece di file_exists($uploadfile)?