I think part of the issue is having this class be re-usable to do many files. I think I'd prefer to make it one-shot. It builds one file, either to completion or removal. That would mean changing the ctor to take 'remoteName' and 'contentType', then giving the class a 'finish' method, which handles any still pending data and the final insert, and a 'cancel' method which discards any pending data and does the remove.

The destructor shouldn't throw so I sort of don't want to do DB ops from there, but you could have some sort of check that one of 'finish' or 'cancel' had been called, and maybe log?