尝试在数据库中插入图像时如何解决错误?

时间:2019-01-09 04:11:16

标签: mysql sql

我做了一个简单的表单(html / php),将图像(.jpg)上传到数据库。表格字段的类型为longblob。仅加载最大1MB的图像。我需要上传至少2MB的图片。我已经更改了php.ini文件,如下所示:

upload_max_filesize = 64M

post_max_size = 128M

memory_limit = 256M

max_execution_time = 120

即使这样做,也没有改变。

返回1个错误和2条警告。

错误:

INSERT INTO `car` (`reg`, `id`, `name`, `img`) VALUES (NULL, NULL, NULL, 0xffd8ffe000104a46494600010101012c012c0000ffee000e41646f626500640000000000ffe110dc4578696600004d4d002a000000080004013b0002000000060000084a8769000400000001000008509c9d00010000000c000010c8ea1c00070000080c0000003e000000001cea00000008000[...]

MySQL said: Documentation 
#2006 - MySQL server has gone away

警告1:

Warning in .\libraries\classes\Dbi\DbiMysqli.php#213
 mysqli_query(): MySQL server has gone away

Backtrace

 .\libraries\classes\Dbi\DbiMysqli.php#213: mysqli_query(
,
string 'INSERT INTO `car` (`reg`, `id`, `name`, `img`) VALUES (NULL, NULL, NULL,

警告2:

Warning in .\libraries\classes\Dbi\DbiMysqli.php#213
 mysqli_query(): Error reading result set's header

Backtrace

 .\libraries\classes\Dbi\DbiMysqli.php#213: mysqli_query(
,
string 'INSERT INTO `car` (`reg`, `id`, `name`, `img`) VALUES (NULL, NULL, NULL,

0 个答案:

没有答案