upload profile image but upload only ram user pic .other user not able to upload there image .how to define every user has upload there prof. image . anyone help me for this problem
// Upload Form
<?php
include("connect.php");
$_SESSION['username']= 'ram';
$username=$_SESSION['username'];
if(isset($_POST['submit']))
{
//get file attributes
$name=$_FILES['myfile']['name'];
$tmp_name=$_FILES['myfile']['tmp_name'];
if($name)
{
//start upload process
$location="$name";
move_uploaded_file($tmp_name,$location);
$query=mysql_query("UPDATE members SET imagelocation='$location' WHERE username='$username'");
die("Your Avatar has been uploaded!! <a href='view.php'></a>");
}
else
{
echo "Please upload a file";
}
}
echo "upload image: <br>
<form action='upload.php' method='POST' enctype='multipart/form-data'>
File:<input type='file' name='myfile'><input type='submit' name='submit' Value='Upload'
</form>
";
?>
//View Form
<?php
require("connect.php");
$username=$_SESSION['username'];
$query=mysql_query("SELECT *FROM members WHERE username='$username'");
if(mysql_num_rows($query)==0)
die("User not found!!!!");
else
{
$row=mysql_fetch_assoc($query);
$location=$row['imagelocation'];
echo "<img src='$location' width='100' height='100'>";
}
?>