Hi there , I am using slim to create my back-end rest api and itry to upload a file use psr 7 in slim and its showing this error upload target path is not writable. please help how to fix it … Thanks in Advance.
//image upload ..
$avatar = $request->getUploadedFiles()['avatar'];
if (empty($avatar)) {
return $response->withHeader('Content-Type' , 'application/json')
->withJson([
'code' => '404',
'message' => 'Expected a avatar..']);
}
if($avatar->getError() === UPLOAD_ERR_OK){
$uploadFileName = $avatar->getClientFilename();
$base_path = __DIR__ . "../assets/uploads/images/";
// var_dump($base_path); die();
$avatar->moveTo($base_path);