PHP 5:将图像上传到MySQL数据库不起作用

时间:2017-02-17 17:45:22

标签: php html sql phpmyadmin upload

我需要将图像文件上传到phpMyAdmin上带有MySQL数据库的字段。已将该字段设置为BLOB文件类型以保存文件,但从网站上传它不起作用。

HTML表单:

expect(isNaN(util.getStartOfDay("hello").getTime())).toBe(true);

PHP上传:

<form method="post" enctype="multipart/form-data">
<p>Select an image to upload:</p>
<input type="file" name="file" id="file">
<input type="submit" value="Upload Image" name="btn-upload">
</form>

MySQL Database (phpMyAdmin)

假设的问题是SQL字符串不正确,只有在最后添加WHERE部分时才会导致错误。此外,如果删除WHERE部分,它将声明'file'变量未定义。我对PHP几乎一无所知,所以如果可能的话,请你能为解决方案添加一些额外的解释。

谢谢。

1 个答案:

答案 0 :(得分:0)

你看过这个类似的帖子吗?在那里提供的答案似乎是你正在寻找的。

How to upload images into MySQL database using PHP code