upload; $newPath = $this->prepareMoveFile($image->getClientOriginalName(), 'uploads'); $newPath = str_replace(storage_path('app'), '', $newPath); $image->storePubliclyAs(pathinfo($newPath, \PATHINFO_DIRNAME), pathinfo($newPath, \PATHINFO_BASENAME)); return response()->json([ 'url' => '/storage' . str_replace('/public', '', $newPath) ]); } }