It sounds like you're trying to make something like: https://github.com/cryptomator/cryptomator
It takes the files that you want to store in the cloud and encrypts them into a bunch of individual files (like encrypted archives) and uploads them to the server. When you access the files it automatically pulls down the archives that contain the files that you want.
You just see a regular directory that's being synced with the cloud, but the cloud service provider only sees you uploading a bunch of encrypted files with nonsense filenames.