Better way of chosing a temporary file