attempt at implementing `attachFile' method