I have this upload page, and when it uploads, it just uploads the file, as a file, not a picture, with no extention. Here is my code:

PHP Code:
if($_POST["action"] == "Upload Image"){
    unset(
$imagename);
    
$memberid $_SESSION['member_id'];
    if(!isset(
$_FILES) && isset($HTTP_POST_FILES))
        
$_FILES $HTTP_POST_FILES;
    
    if(!isset(
$_FILES['image_file']))
        
$error["image_file"] = "An image was not found.";
    
    
#One Directory for ALL pics, random filename
    
$rand1 rand(199);
    
$rand2 rand(100999);
    
$rand3 rand(10009999);
    
$rand $rand3 $rand2 $rand1;
    
$imagename $memberid "_" $rand;
    
    
/*
    #One dir for each member, original file names, or random is file name doesnt exitst
    $imagename = basename($_FILES['image_file']['name']);
    if(empty($imagename))
        $rand1 = rand(1, 99);
        $rand2 = rand(100, 999);
        $rand3 = rand(1000, 9999);
        $rand = $rand3 - $rand2 + $rand1;
        $imagename = $memberid . "_" . $rand;
    */
    
    
if(empty($error))
    {
        
$newimage "pics/" $imagename;
        
//$newimage = "pics/$memberid/" . $imagename;
        //echo $newimage;
        
$result = @move_uploaded_file($_FILES['image_file']['tmp_name'], $newimage);
        if(empty(
$result)) {
            
$error["result"] = "There was an error moving the uploaded file.";
        } else {
            
$url "http://pics.rapidfriends.com/" $imagename;
            
$sql1 "SELECT `picture_id` FROM `pictures` WHERE member_id='$memberid'";
            
$query1 mysql_query($sql1);
            
$num mysql_num_rows($query1);
            
            if (
$num == "0") {
                
$sql2 "UPDATE `members` SET `default_pic_url`='$url' WHERE member_id='$memberid'";
                
$query2 mysql_query($sql2);
            }
            
$caption $_POST['caption'];
            
$sql "INSERT INTO `pictures` SET url='$url', member_id='$memberid', caption='$caption'";
            
$query mysql_query($sql);
            echo 
mysql_error();
            echo 
"Your Picture Was successfuly Uploaded:<br><br>";
            include(
"includes/functions.php");
            
$showimg getimagesize($url); 
            
$imgtag imageResize($showimg[0], $showimg[1], 150);
            echo 
"<img src='$url' title='$caption$imgtag><br><br>Direct URL: $url<br><br><br>";
        }
    }


in the db, the url is as follows: http://pics.rapidfriends.com/13_6510
notice no extention, and it still goes to a picture, with the jpeg format... I dont understand whats going wrong...