Complex file upload and download is functional

Implementation is not good at all. It must be cleaned up.