The tempfile has to be named predictably so that it can be found across multiple requests, so my sense it that the tempfile package wouldn't be of much use.