我确定我在做一些愚蠢的事情,但我已经检查并重新检查了这一点。这是我的照片上传器,旨在将照片文件本身保存到一个文件夹(名为“reccs”),然后将照片的名称保存到我的数据库中的一行。DB 部分运行良好,但我的照片没有显示在文件夹中。它没有显示任何错误并且似乎正在工作(我收到“成功”消息)。确认!
代码如下。感谢您的任何见解。
$link = mysql_pconnect($host, $username, $password);
$db = mysql_select_db ($dbname);
$target = "reccs/";
$target = $target . basename($_FILES['photo']['name']);
$pic=($_FILES['photo']['name']);
mysql_query("UPDATE login SET recc = '$pic' WHERE username = '".$_SESSION['user']['username']."'");
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
{
echo "The file has been uploaded, and your information has been added to the directory";
}
else {
echo "Sorry, there was a problem uploading your file.";
}