// error checking
if (!array_key_exists('menu', $_REQUEST)) {
    die("no 'menu' value specified!");
}
if (!@$_REQUEST['fieldName']) {
    die("no 'fieldName' value specified!");
}
if (!@$_REQUEST['num'] && !@$_REQUEST['preSaveTempId']) {
    die("No record 'num' or 'preSaveTempId' was specified!");
}
// get uploads
$uploads = array();
$fieldSchema = $schema[$_REQUEST['fieldName']];
$hasModifyFields = @$fieldSchema["infoField1"] || @$fieldSchema["infoField2"] || @$fieldSchema["infoField3"] || @$fieldSchema["infoField4"] || @$fieldSchema["infoField5"];
$uploadCount = 0;
$records = getUploadRecords($tableName, $_REQUEST['fieldName'], @$_REQUEST['num'], @$_REQUEST['preSaveTempId'], null);
foreach ($records as $row) {
    $filename = pathinfo($row['filePath'], PATHINFO_BASENAME);
    $jsEscapedFilename = addcslashes(htmlencode($filename), '\\\'');
    $row['_modifyLinkJS'] = "modifyUpload('{$row['num']}', '{$jsEscapedFilename}', this); return false;";
    $row['_removeLinkJS'] = "removeUpload('{$row['num']}', '{$jsEscapedFilename}', this); return false;";
    $row['_infoFields'] = '';
    foreach (range(1, 5) as $num) {
        $fieldLabel = @$fieldSchema["infoField{$num}"];
        $fieldValue = @$row["info{$num}"];
        if (!$fieldLabel) {
            continue;
        }
        $row['_infoFields'] .= htmlencode($fieldLabel) . ': ' . htmlencode($fieldValue) . "<br/>\n";
    }
    $uploads[] = $row;
      </td>
   </tr>
  <?php 
}
?>

  </table>

<br/>

  <div style="font-size: 10px; color: #888888; padding: 0px 2px; text-align: center" align="center">

    <div style="float: left;">
      <?php 
if (@$_REQUEST['uploadNums']) {
    $uploadRecordsCount = count(getUploadRecords($tableName, $_REQUEST['fieldName'], @$_REQUEST['num'], @$_REQUEST['preSaveTempId']));
    if ($uploadRecordsCount > 1) {
        $url = http_build_query(array('action' => 'uploadModify', 'menu' => @$_REQUEST['menu'], 'fieldName' => @$_REQUEST['fieldName'], 'num' => @$_REQUEST['num'], 'preSaveTempId' => @$_REQUEST['preSaveTempId']));
        ?>
          <a href="?<?php 
        echo htmlencode($url);
        ?>
"><?php 
        printf(t("Modify All %s Uploads"), $uploadRecordsCount);
        ?>
</a>
        <?php 
    }
    ?>
      <?php 
}