} elseif (isset($_POST['selected'])) {
    //we dont get the button :(
    $status = array();
    $filenames = array();
    foreach ($_POST['field'] as $key => $value) {
        $uploadmanager = new UploadManager();
        $square = new GridSquare();
        $files_key = str_replace('.', '_', $value);
        $filenames[$key] = $_FILES[$files_key]['name'];
        $ok = $square->setByFullGridRef($_POST['grid_reference'][$key]);
        if ($ok) {
            // set up attributes from uploaded data
            $uploadmanager->setSquare($square);
            $uploadmanager->setViewpoint($_POST['photographer_gridref'][$key]);
            $uploadmanager->setDirection($_POST['view_direction'][$key]);
            $uploadmanager->setUse6fig(stripslashes($_POST['use6fig'][$key]));
            $uploadmanager->setTaken($_POST['imagetaken'][$key]);
            $uploadmanager->setTitle(utf8_decode($_POST['title'][$key]));
            $uploadmanager->setTitle2(utf8_decode($_POST['title2'][$key]));
            if ($_POST['comment'][$key] != "comment[{$key}]") {
                //bug? in Picasa sends the name in the value if blank, useful! (but only seems to apply to textareas)
                $uploadmanager->setComment(utf8_decode($_POST['comment'][$key]));
            }
            if ($_POST['comment2'][$key] != "comment2[{$key}]") {
                //bug? in Picasa sends the name in the value if blank, useful! (but only seems to apply to textareas)
                $uploadmanager->setComment2(utf8_decode($_POST['comment2'][$key]));
            }
            if (($_POST['imageclass'][$key] == 'Other' || empty($_POST['imageclass'][$key])) && !empty($_POST['imageclassother'][$key])) {
                $imageclass = stripslashes($_POST['imageclassother'][$key]);
            } else {
                if ($_POST['imageclass'] != 'Other') {