Remove onbeforeupload attributes instead of setting them to ""

This fixes extra "onbeforeupload" attributes in saved files.