Index: extensions/upload_form/language/en_UK/plugin.lang.php
===================================================================
--- extensions/upload_form/language/en_UK/plugin.lang.php	(revision 4810)
+++ extensions/upload_form/language/en_UK/plugin.lang.php	(revision 4811)
@@ -35,3 +35,4 @@
 $lang['Privacy level set to "%s"'] = 'Privacy level set to "%s"';
 $lang['Category "%s" now contains %d photos'] = 'Category "%s" now contains %d photos';
+$lang['Manage this set of %d photos'] = 'Manage this set of %d photos';
 ?>
Index: extensions/upload_form/language/fr_FR/plugin.lang.php
===================================================================
--- extensions/upload_form/language/fr_FR/plugin.lang.php	(revision 4810)
+++ extensions/upload_form/language/fr_FR/plugin.lang.php	(revision 4811)
@@ -35,3 +35,4 @@
 $lang['Privacy level set to "%s"'] = 'Niveau de confidentialité "%s"';
 $lang['Category "%s" now contains %d photos'] = 'La catégorie "%s" contient désormais %d photos';
+$lang['Manage this set of %d photos'] = 'Gérer ce lot de %d photos';
 ?>
Index: extensions/upload_form/upload.php
===================================================================
--- extensions/upload_form/upload.php	(revision 4810)
+++ extensions/upload_form/upload.php	(revision 4811)
@@ -30,5 +30,4 @@
 
 $admin_base_url = get_root_url().'admin.php?page=plugin&section=upload_form%2Fupload.php';
-$thumbnails = array();
 
 // +-----------------------------------------------------------------------+
@@ -36,4 +35,38 @@
 // +-----------------------------------------------------------------------+
 check_status(ACCESS_ADMINISTRATOR);
+
+// +-----------------------------------------------------------------------+
+// |                        batch management request                       |
+// +-----------------------------------------------------------------------+
+
+if (isset($_GET['batch']))
+{
+  check_input_parameter('batch', $_GET['batch'], false, '/^\d+(,\d+)*$/');
+
+  $query = '
+DELETE FROM '.CADDIE_TABLE.'
+  WHERE user_id = '.$user['id'].'
+;';
+  pwg_query($query);
+
+  $inserts = array();
+  foreach (explode(',', $_GET['batch']) as $image_id)
+  {
+    array_push(
+      $inserts,
+      array(
+        'user_id' => $user['id'],
+        'element_id' => $image_id,
+        )
+      );
+  }
+  mass_inserts(
+    CADDIE_TABLE,
+    array_keys($inserts[0]),
+    $inserts
+    );
+
+  redirect(get_root_url().'admin.php?page=element_set&cat=caddie');
+}
 
 // +-----------------------------------------------------------------------+
@@ -77,5 +110,8 @@
     }
   }
-  
+
+  $image_ids = array();
+  $page['thumbnails'] = array();
+      
   $starttime = get_moment();
   
@@ -93,4 +129,6 @@
         $_POST['level']
         );
+
+      array_push($image_ids, $image_id);
 
       // TODO: if $image_id is not an integer, something went wrong
@@ -135,5 +173,5 @@
         ;
 
-      array_push($thumbnails, $thumbnail);
+      array_push($page['thumbnails'], $thumbnail);
     }
   }
@@ -143,5 +181,5 @@
   // printf('%.2f ms', $elapsed);
 
-  if (!empty($thumbnails))
+  if (!empty($page['thumbnails']))
   {
     array_push(
@@ -149,5 +187,5 @@
       sprintf(
         l10n('%d photos uploaded'),
-        count($thumbnails)
+        count($page['thumbnails'])
         )
       );
@@ -187,4 +225,6 @@
         );
     }
+
+    $page['batch_link'] = $admin_base_url.'&batch='.implode(',', $image_ids);
   }
 }
@@ -204,7 +244,29 @@
       'F_ADD_ACTION'=> $admin_base_url,
       'plugin_path' => UPLOAD_FORM_PATH,
-      'thumbnails' => $thumbnails,
     )
   );
+
+if (isset($page['thumbnails']))
+{
+  $template->assign(
+    array(
+      'thumbnails' => $page['thumbnails'],
+      )
+    );
+
+  // only display the batch link if we have more than 1 photo
+  if (count($page['thumbnails']) > 1)
+  {
+    $template->assign(
+      array(
+        'batch_link' => $page['batch_link'],
+        'batch_label' => sprintf(
+          l10n('Manage this set of %d photos'),
+          count($page['thumbnails'])
+          ),
+        )
+      );
+  }
+}
 
 $query = '
Index: extensions/upload_form/upload.tpl
===================================================================
--- extensions/upload_form/upload.tpl	(revision 4810)
+++ extensions/upload_form/upload.tpl	(revision 4811)
@@ -22,4 +22,8 @@
   margin-bottom:2px;
   padding:0;
+}
+
+#batchLink {
+  text-align:center;
 }
 </style>
@@ -50,4 +54,5 @@
   {/foreach}
   </div>
+  <p id="batchLink"><a href="{$batch_link}">{$batch_label}</a></p>
 </fieldset>
 {/if}
