0

该脚本似乎将图像上传到一个文件夹,这是有效的。但它应该将图像上传到会话名称匹配的行。

相反,我返回了“0”的值。我不知道为什么?这与我的查询有关吗?

      <? 
error_reporting(E_ERROR | E_PARSE);

  $name = $fgmembersite->UserFullName(); 
   if (!$name) {
    echo "Boo!";
}
 if ($_POST['submit']) {
    //get file attributes

    $Name = $_FILES['myfile']['name'];
    $tmp_name = $_FILES['myfile']['tmp_name'];
    error_reporting(E_ERROR | E_PARSE);

    if ($Name) {            
    $location = "avatars/$Name";    
    move_uploaded_file($tmp_name, $location ) or die('Failed to upload picture');
    $query = mysql_query("UPDATE fgusers3 SET imagelocation='$location' WHERE name='$name'");      die("Your profile image has been uploaded!");
    if (!$query) {
        die("Did not upload correctly");
    }
        }}



 error_reporting(E_ERROR | E_PARSE);


echo "Upload your image below:
  <form action='profilepic.php' method='POST' enctype='multipart/form-data'>
   Profile Picture: <input type='file' name='myfile'> <input type='submit' name='submit' value='upload'>
   </form>
";

    ?>
4

0 回答 0