$imgname= "name";
$ext = substr($_FILES["filename"]["name"], 1 + strrpos($_FILES["filename"]["name"], "."));
$img= $imgname.".".$ext;
$img = $_FILES["filename"]["name"];//проверка добавили ли картинку
move_uploaded_file($_FILES["filename"]["tmp_name"], "/user/images/logo/".$img);
$sql = mysql_query ("UPDATE `company` SET `img` = '$img' WHERE User_ID='$UserID'");
$img_info = pathinfo( $_FILES["filename"]["name"] );
$ext = $img_info["extension"];