Note that this isn't the primary function of Dropbox. As you know, the Dropbox site and apps are for syncing files to users and your other devices.
However, there is a way using a workaround to keep your files only on the Dropbox site, to keep them safe online, and yet not take up space on your devices.