write to local tempfile then upload