not getting value of file in php
<p>I have problem with getting name of image.<br>
I have use following code to update image under upload folder.<br>
I am updating image path with  <code>$image= time()."_".strtolower(str_replace($tokan, "" ,$file));</code></p>

<p>time function use to add time stamp before image name.<br>
but problem is only time_ path update I did not get the file name in that.</p>

<p>for example:<br>
if I am browsing image using file type like sunset.jpg<br>
I only get "time_" not sunset.jpg... </p>

<pre><code>&lt;?php
    $host="localhost"; 
    $username="root"; 
    $password=""; 
    $db="training_swapnil"; 
    $tbl="gallary"; 
    $tb="album";
    $img_id=$_GET['id'];
    mysql_connect("$host", "$username", "$password")or die("cannot connect");
    mysql_select_db("$db")or die("cannot select DB");
    $q="SELECT * FROM $tbl WHERE eid='$img_id'";
    $r=mysql_query($q);
    $rw= mysql_fetch_assoc($r);
    echo $img=stripslashes($rw['image']);?&gt;                

  &lt;form name="update_img"&gt;
    &lt;table border="0"&gt;&lt;tr&gt;
     &lt;td&gt;&lt;label&gt;Uploaded Image:&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;?php echo "&lt;img src=\"uploads/$img\" width=\"150\" height=\"150\" /&gt;";?&gt;&lt;/td&gt;&lt;/tr&gt;
       &lt;tr&gt;&lt;td&gt;&lt;label&gt;Upload New Image:&lt;/label&gt;&lt;/td&gt;&lt;td&gt;    &lt;input type="file" name="file" id="file"/&gt;&lt;/td&gt;&lt;/tr&gt;
       &lt;tr&gt;&lt;td&gt;&lt;input type="submit" name="submit" value="upload"&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;?php     
         echo"here in post";
         $file=$_POST['file'];
        //$str=$HTTP_POST_FILES['file']['name'];
          echo "str file =$str";
         $tokan = array(" ", "'","`","’");
        //$image= time().".$file.";         
        $image= time()."_".strtolower(str_replace($tokan, "" ,$file));
        $path= "uploads/".$image;
        echo "path using file=$image";
        $sql="UPDATE gallary  set image='$image', path='$path' WHERE eid='$img_id'"; 
        echo $sql;
        $res=mysql_query($sql);
        $res=mysql_query($s);
            if($res&gt;0)
        {
            if($file !=none)
            {                                      if(copy($HTTP_POST_FILES['file']['tmp_name'], $path))              {                                               //header("location:viewalbum.php");
        }
        else
        {
            echo "Error";
        }
    }
 }
?&gt;
&lt;/table&gt;&lt;/form&gt;
</code></pre>
