File Upload form issue I have been working on this code and I am having some errors, and I was wondering if anybody can find errors in this code...  I have posted my error below it...

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


$form['background_audio_file']['file'] = array(
  '#type' =&gt; 'managed_file',
  '#title' =&gt; t('File'),
  '#description' =&gt; t('Allowed extensions: mp3'),
  '#upload_location' =&gt; 'public://MP3/',
  '#default_value' =&gt; variable_get('background_audio_file'),
  '#upload_validators' =&gt; array(
    'file_validate_extensions' =&gt; array('gif png jpg jpeg mp3'),
  ),
);



$form['submit'] = array(
  '#type' =&gt; 'submit',
  '#value' =&gt; t('Save Changes'),
);



  return $form;
}

function background_audio_form_submit($form, $form_state) {

 // The file is automatically uploaded and saved in the default
 // validation process so you just need to load the file object at this point,
 // mark that you want to keep it, and save it again.
 // The file ID is contained in the $form_state['values'] array
 $file = file_load($form_state['values']['background_audio_file']);
 $file-&gt;status = FILE_STATUS_PERMANENT;
 file_save($file);

 $fid = $form_state['values']['background_audio_file'];

 $fileid = file_load($fid);

 variable_set('background_audio_upload_path', $fileid-&gt;uri);

}



Notice: Undefined index: background_audio_file in background_audio_form_submit() (line 107 of /Users/jtharpe/Overflow_Dev/sites/all/modules/background_audio/background_audio.module).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController-&gt;load() (line 178 of /Users/jtharpe/Overflow_Dev/includes/entity.inc).
Notice: Undefined property: stdClass::$uri in file_save() (line 573 of /Users/jtharpe/Overflow_Dev/includes/file.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri': INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] =&gt; 0 [:db_insert_placeholder_1] =&gt; 1 [:db_insert_placeholder_2] =&gt; 1329961119 ) in drupal_write_record() (line 6975 of /Users/jtharpe/Overflow_Dev/includes/common.inc).
In your $form FAPI usage you called the file key file, a child element of the parent container background_audio_file. In your _submit() function you are not looking for file.

Do a Devel dpm($form_state['values']) or a print_r($form_state['values']) and you will see the key file with your content. Besides that your code looks ok.