1. Go to this page and download the library: Download ijin82/flysystem-webdav library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
public function avatarUpload(Request $request)
{
//...
$file = $request->file('avatar_file');
//... check file type, build name, save name in DB, whatever you like
$fileName = $file->getClientOriginalName(); // for example
// https://laravel.com/docs/5.5/requests#storing-uploaded-files
$file->storeAs('subfolder-name-or-empty', $fileName, ['disk' => 'avatars']);
//...
// save file name or logic to build that
//...
}