我有問題上傳文件,通過苗條的框架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
我已經實現完全一樣,但我仍然無法通過郵遞員上傳文件。總是拋出關鍵字丟失的異常 –