<?php
function smarty_function_admin_upload($params, &$smarty) {
	//
	global $section;
	global $data;
	global $key_name;
	$target = HOME_DIR."data/".$section."/assets/".$_FILES['file']['name'];
	$smarty->assign("success", "Unknown error.");
	$permitted_files = array("image/jpeg","image/gif","audio/mpeg3");
	//
	if(in_array($_FILES['file']['type'], $permitted_files)) {
		if(@move_uploaded_file($_FILES['file']['tmp_name'], $target)) {
			$smarty->assign("success", "true");
		} else {
			$smarty->assign("success", "Upload problem.");
		}
	} else {
		$smarty->assign("success", "File type problem.");
	}
}
?>