This app was mentioned in 5 comments, with an average of 1.60 upvotes
Rsync (is a tool to sync files and folders between machines/devices/end points)
Rsync wrapper will do this for you via ssh - https://play.google.com/store/apps/details?id=net.letscorp.rsyncwrapper&hl=en_US
Over the years have tried different things... Foldersync / SMBSync / NextCloud App etc...
These days I just use Rsync Wrapper - it just works. Added bonus is it is the only Android rsync that I have found that accepts full command syntax. Set and forget direct to FreeNAS daily without needing a VM.
https://play.google.com/store/apps/details?id=net.letscorp.rsyncwrapper&hl=en
I was going to suggest maybe rsync but from reading the play store description you may have trouble with external storage with out root access.
I use RSync wrapper. 0 bug since 2 years. You can choose to transfer data only on WiFi and plugged phone. https://play.google.com/store/apps/details?id=net.letscorp.rsyncwrapper
On android you could use https://www.tacit.dk/foldersync/ to push to basically any backend you could imagine (SSH/WebDAV/GDrive/Dropbox, etc). FolderSync is not open source, and doesn't have an iOS app but I can imagine something similar existing for that platform (and there are open source alternatives for android, like https://play.google.com/store/apps/details?id=net.letscorp.rsyncwrapper&hl=en for an rsync backend).
​
Above solution doesn't give you a nice gallery though. If you were to push to a NAS at home you might have a gallery on there.
​
If you really need that gallery, nextcloud would be a proper solution. Would need a bit more effort and maintenance to setup and I personally don't like the upload features (no button for instant 'emergency' upload, which foldersync has, and no two-way sync). You could however setup FolderSync to push to nextclouds webdav endpoint and have the best of both worlds.