Blob上传到数据库失败

时间:2015-01-04 14:02:34

标签: php mysql blobstorage

出于某些明显的原因,我试图通过我的表单上传到数据库的任何图像都不起作用。 我尝试通过相同的脚本上传其他文件tipes(.txt)并且它工作得很好。我已经在localhost和大型服务器上尝试了它但它不起作用。 我认为查询太长了,无法处理...我已经尝试了一切,但似乎没有任何工作。请帮助 (请不要建议我避免斑点,我知道缺点。 这是代码。谢谢

if(isset($_POST['submit'])){
    if(isset($_FILES['image']['name'])){
        $tmp_name=$_FILES['image']['tmp_name'];
        $user=$_SESSION['username'];
        $image_data=file_get_contents($tmp_name);
        $query_1="UPDATE users SET profile_image='$image_data' WHERE username='$user'";
        require 'connect.php';
        if(mysqli_query($conn,$query_1)){
            echo "ok";
        }else{
            echo'error';
        }
    }
})

0 个答案:

没有答案