Can't get AJAX on file upload working I have a managed_file form element. I want to trigger an AJAX callback when a user clicks the upload button. But I can't seem to get anything working by attaching the #ajax element to the managed_file element. I know the managed_file element creates an upload button automatically, so I tried to hook into that using hook_form_alter but the button doesn't seem to have been created yet, so I can't attach the AJAX handler.

Any ideas?
No, unfortunately, you can't use #ajax because managed_file uses it internally for its own purposes.