add server logic for upload and download