Replace
flash[:alert] = t("uploading_error")
with
flash.now.alert = t("uploading_error")
and see if that is the result you expect?
flash[:alert] will stay around for the next page (hence it only disappears at the second redirect); but flash.now.alert will only display for the current page.