added onerror handler for upload