【发布时间】:2017-11-01 20:35:11
【问题描述】:
我正在尝试使用邮递员上传图片,但图片未插入数据库中
这是错误
对我应该怎么做有什么建议吗?
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'image' cannot be null (SQL: insert into `images` (`image`) values ())
这是路线
$app->post('/images', function($request, $response, $args) {
$data = $request->getUploadedFiles();
$image = new Image();
$image->image = $data['image'];
$image->save();
return $this->response->write($image->toJson());
});
这里是邮递员页面
这里是标题
【问题讨论】:
-
您确定邮递员在请求中正确发送了图片吗?
-
你能分享一下你是如何使用邮递员来测试api调用的吗?
-
@bos570 我刚刚编辑了它的样子
-
能分享一下标题吗?
-
@bos570 我刚刚更新了,现在看看,谢谢:)