7: Form API: managed_file: AJAX upload error "Undefined index ... in file_ajax_upload()"
You need to pass the parameters by reference if you want changes to persist outside the function scope:

function ajax_example_autocheckboxes_callback(&amp;$form, &amp;$form_state) {