我有问题上传文件,通过苗条的框架3 Slim \ Http \ UploadedFile。Slim Framework 3上传
我的代码:
$app->post('/upload', function ($req, $res, $args) {
$setting = $this->settings;
$uploadPath = $setting['upload']['path'];
$file = $req->getUploadedFiles()['img'];
$file->moveTo($uploadPath);
return $res;
});
结果:
Slim Application Error
The application could not run because of the following error:
Details
Type: RuntimeException
Message: Error moving uploaded file hss.png to /home/xxx/web/slim3/app/../log
File: /home/xxx/web/slim3/vendor/slim/slim/Slim/Http/UploadedFile.php
Line: 237
我已经实现完全一样,但我仍然无法通过邮递员上传文件。总是抛出关键字丢失的异常 –