diff --git a/imagefield_zip.module b/imagefield_zip.module
index 5debcc0..570e795 100644
--- a/imagefield_zip.module
+++ b/imagefield_zip.module
@@ -216,9 +216,9 @@ function imagefield_zip_save_and_extract_upload($field_name) {
 function imagefield_zip_page_submit($form, &$form_state) {
   // Get info from the form.
   $type = content_types($form['#node']->type);
-  $form_element_children = element_children($form);
   module_load_include('inc', 'content', 'includes/content.node_form');
   global $user;
+  $groups = imagefield_zip_get_groups($form);
 
   // Select the correct fields from the form.
   $out = array();
@@ -227,46 +227,71 @@ function imagefield_zip_page_submit($form, &$form_state) {
     $field = content_fields($zip_field['field_name'], $form['#node']->type);
     $dest = filefield_widget_file_path($field);
 
-    foreach ($form_element_children as $field_name) {
-      // Skip if not a zip upload field.
-      if ($zip_field['field_name'] . '_zip' != $field_name || empty($form[$field_name][$zip_field['field_name'] . '_upload'])) {
-        continue;
+    // Get group names.
+    $group_names = array();
+    if (!empty($groups)) {
+      foreach ($groups as $group_name => $group) {
+        if (!empty($group['fields'][$zip_field['field_name']])) {
+          // Code adapted from content_multigroup_add_more().
+          if (empty($group['settings']['multigroup']['multiple']) || (isset($group['settings']['multigroup']['multiple']) && $group['settings']['multigroup']['multiple'] != 1)) {
+            continue;
+          }
+          $group_names[] = $group_name;
+        }
       }
+    }
 
-      // Get images from the zip file.
-      $images = imagefield_zip_save_and_extract_upload($field_name);
-      if (empty($images)) {
-        continue;
+    // Set & find zip upload field name.
+    $field_name = $zip_field['field_name'] . '_zip';
+    $group_id = -1;
+    $found = FALSE;
+    while (!$found) {
+      $found = imagefield_zip_array_find_element_by_key($field_name, $form);
+      $group_id++;
+      if (!$found && !empty($group_names[$group_id])) {
+        $field_name = $group_names[$group_id] . '_zip';
+      }
+      else {
+        break;
       }
+    }
+    if (!$found) {
+      continue;
+    }
+
+    // Get images from the zip file.
+    $images = imagefield_zip_save_and_extract_upload($field_name);
+    if (empty($images)) {
+      continue;
+    }
 
-      // Put the file in the new element.
-      foreach ($images as $image) {
-        if ($file = field_file_save_file($image->filepath, array(), $dest)) {
-          foreach ($form_state['values'] as $value_field_name => &$value_field_data) {
-            // Skip if not the correct field.
-            if ($zip_field['field_name'] != $value_field_name) {
-              continue;
-            }
-
-            // Find an empty delta and save
-            $delta = 0;
-            while (!empty($value_field_data[$delta]['fid'])) {
-              $delta++;
-            }
-
-            // Add info and save into $form_state['values'].
-            $file += array(
-              'data' => array('title' => FALSE, 'alt' => FALSE),
-              'list' => TRUE,
-              '_weight' => $delta,
-              'uid' => $user->uid,
-              '_remove' => 0,
-              'upload' => FALSE,
-            );
-            unset($file['destination']);
-            unset($file['source']);
-            $value_field_data[$delta] = $file;
+    // Put the file in the new element.
+    foreach ($images as $image) {
+      if ($file = field_file_save_file($image->filepath, array(), $dest)) {
+        foreach ($form_state['values'] as $value_field_name => &$value_field_data) {
+          // Skip if not the correct field.
+          if ($zip_field['field_name'] != $value_field_name) {
+            continue;
           }
+
+          // Find an empty delta and save
+          $delta = 0;
+          while (!empty($value_field_data[$delta]['fid'])) {
+            $delta++;
+          }
+
+          // Add info and save into $form_state['values'].
+          $file += array(
+            'data' => array('title' => FALSE, 'alt' => FALSE),
+            'list' => TRUE,
+            '_weight' => $delta,
+            'uid' => $user->uid,
+            '_remove' => 0,
+            'upload' => FALSE,
+          );
+          unset($file['destination']);
+          unset($file['source']);
+          $value_field_data[$delta] = $file;
         }
       }
     }
@@ -274,6 +299,28 @@ function imagefield_zip_page_submit($form, &$form_state) {
 }
 
 /**
+ * Returns the value of the key in a multidimensional array.
+ *
+ * http://php.net/array-key-exists#85184
+ */
+function &imagefield_zip_array_find_element_by_key($key, &$form) {
+  if (array_key_exists($key, $form)) {
+    $ret = &$form[$key];
+    return $ret;
+  }
+  foreach ($form as $k => $v) {
+    if (is_array($v)) {
+      $ret = &imagefield_zip_array_find_element_by_key($key, $form[$k]);
+      if ($ret) {
+        return $ret;
+      }
+    }
+  }
+  $x = FALSE;
+  return $x;
+}
+
+/**
  * Implementation of hook_form().
  */
 function _imagefield_zip_form(&$form, &$field_name, &$node, &$groups) {
