<?
include($_SERVER['DOCUMENT_ROOT'].'/config.php');
include($_SERVER['DOCUMENT_ROOT'].'/funkcion.php');

// Загрузка фотографий меню
$rand = rand(0, 10000);
$uploaddir = ($_SERVER['DOCUMENT_ROOT'].'/upload/sale/'); 
$file = $uploaddir . basename($rand.translit_p($_FILES['uploadfile']['name'])); 
$name = basename($rand.translit_p($_FILES['uploadfile']['name']));

if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) {
mysql_query("INSERT INTO `nano_sale` (`name`) VALUES('$name')");
echo "1"; 
}
?>