document uploading and downloading consistency logic