If the user double-clicks a file, the application must download this file to the system's temp directory and open it. If a file was already opened before, just open the previously downloaded file.
If the user asks this file for download, the previously downloaded file is just copied to the given location.
Finally, when the user reloads a device's folder, all those 'cached' images of that folder are purged.
A caching mechanism shall be created to deal with this stuff appropriately.