$extensions = array('pdf', 'doc', 'docx');
$allowed = false;
foreach ($extensions as $ext) {
	if(pathinfo($value, PATHINFO_EXTENSION) == $ext) {
		$allowed = true;
	}
}

if(!$allowed) {
 unlink($value);
 $value = 'not allowed';
}
else {
$value = end(explode('/', $value));
}

