Need to uplad a file from admin account to other user

I am getting files from different users and need to upload those files to their respective folder. I am trying to upload the files using curl -u adminUserName:adminPassword -T “fileName” “https://nextcloud.local.com/remote.php/dav/files/username
But I am getting “Permission forbidden” Not able to create filename …

Now i tried to scp to the folder nextcloud/data/files/username/, it got copied successfully, but I am not able to see the file when i login on web browser.
I think, OCC command also required to add in the database. Please tell me how to do it.
Thanks

They can share the folder read/write to you or to the world. Then you can upload with Nextcloud functions.

path is nextcloud/data/username/files :wink:

You must rescan the files with occ if you not using Nextcloud functions or WebDAV.

sudo -u www-data php occ files:scan username
or
sudo -u www-data php occ files:scan --all

documentation