file_save_upload with multiple form I have a form with the following input field:

&lt;input type="file" name="photo_files[]" /&gt;


I would like to save each of this files using file_save_upload and then change their status to permanent via file_save. It seems file_save_upload only takes a name and NOT an array. How can I accomplish this?
Here is how you could do it.

function mymodule_testes($form, $form_state) {
// your form definition goes here
  $form = array();
  $form['upload'] = array( // note the key
    '#type' =&gt; 'file',
    '#title' =&gt; t('Choose a file'),
    '#weight' =&gt; -10,
  );

  $form['upload2'] = array(
    '#type' =&gt; 'file',
    '#title' =&gt; t('Choose a file'),
    '#weight' =&gt; -10,
  );

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

  return $form;
}

function mymodule_testes_validate($form, $form_state) {
  dpm($form_state);
  // pass proper args to file_save_upload .. see documentation 
  $file1 = file_save_upload('upload' , array()); // remember the key
  $file2 = file_save_upload('upload2' , array());
  // you dont have to do it verbosly
  // Do all your  validations  if(!$file1 || !$file2) form_set_error ...

  // save it onto form_State
  $form_state['files_storage'][0] = $file1 
  $form_state['files_storage'][1] = $file1
  dpm($file1);
  dpm($file2);

}


function mymodule_testes_submit($form, $form_state) {
 // using devel so you could see how it is stored 
 dpm($form_state);

  foreach ($form_state['files_storage'] as $key =&gt; $file) {
    $file-&gt;status = FILE_STATUS_PERMANENT;
    file_save($file);
  }
}


Hope this helps