// Check his status.
if (!empty($_SESSION[username]))
{
echo "Hi, <b>$_SESSION[username]</b>.";
if ($_POST['submit'])
{
//get file attributes
$name = $_FILES['myfile']['name'];
$tmp_name = $_FILES['myfile']['tmp_name'];
if ($name)
{
//start upload process
$location = "avatars/$name";
move_uploaded_file($tmp_name,$location);
$query = mysql_query("UPDATE members SET imagelocation='$location' WHERE username='$username'");
die("Your image has been uploaded! <a href='dashboard.php'>Back</a>");
}
else
die("Please select file");
}
echo "upload your image:
<form action='profile.php' method='POST' enctype='multipart/formdata'>
File: <input type='file' name='myfile'> <input type='submit' name='Submit' value='Upload'></form>";
}
它显示用户名很好,我在数据库中有正确的表和列但是当你点击上传时它什么都不做?
您可以通过以用户名登录自己查看:test 密码:test url:learning.iamdanbarrett.com