open(UPLOAD, ">$tempfile") or die "Cannot write $tempfile: $!";