MDL-44257 message: added test to make sure the stored file still exists
MDL-44257 lib: fix the attachment code to accept tempdir and dataroot.

Credit goes to Damyon, thanks.