amazons3-7-x-2.0, Multiple upload to S3, #upload_location wrong URI
ok, after spending a few hours debugging the code, I have finally identified  the problem and come out with a solution :

Amazons3 implements a amazons3_field_widget_form_alter that fixes the $element['#upload_location'] :


  function amazons3_field_widget_form_alter(&amp;$element, &amp;$form_state, $context) {
  
  $field = $context['field'];
    $instance = $context['instance'];
    $delta = $context['delta'];
  
  if (in_array($field['type'], amazons3_file_like_field())) {
      $element[$delta]['#upload_location'] = amazons3_field_widget_uri($field, $instance);
    }
  } 


The problem is that this function is only called once, on $delta=0. Thus, it only fixes the first delta instance of the field, correcting the first upload. But the second upload fails because the bucketname is not in the remote URI.

In order to fix this, I propose the wrote following function in my module :


  function mymodule_field_widget_form_alter(&amp;$element, &amp;$form_state, $context){
      // On essaie de corriger les settings upload_location
      if (!function_exists('amazons3_file_like_field')) {
          return;
      }
      $field = $context['field'];
      $instance = $context['instance'];
      $delta = $context['delta'];

if (in_array($field['type'], amazons3_file_like_field())) {
    foreach (array_keys($element) as $count =&gt; $key) {
        if (is_numeric($key) &amp;&amp; isset($element[$key]['#upload_location']) &amp;&amp; !(strpos($element[$key]['#upload_location'],'s3://')===FALSE)) {
            $element[$key]['#upload_location'] = amazons3_field_widget_uri($field, $instance);
        }
    }
}
return;

  
  }


It works well, allowing multiple uploads in S3 with the new release of the library. 
Next step would be to post a patch to the amazons3 module. Which I will do now.