Significantly reworked the upload/download code so a filestream is used.