public function doPOST($sandbox, &$bashcode, &$database)
    {
        $bashstring = <<<EOS
DBDIR=\${DBFILE}.d/
rm -rf \${DBDIR} || true
mkdir \${DBDIR}
cd \${DBDIR}
tar xf \${DBFILE}
if   [ \$( ls -1d *.pal 2>/dev/null | wc -l ) -eq 1 ]; then
  DB=\$( basename *.pal .pal )
elif [ \$( ls -1d *.pin 2>/dev/null | wc -l ) -eq 1 ]; then
  DB=\$( basename *.pin .pin )
else
  echo "No valid database found"
  exit 2
fi
cd \${OUTDIR}
\${APPDIR}omssa-2.1.4/omssacl -d \${DBDIR}\${DB}
EOS;
        // Check -d parameter
        if (empty($_POST[$this->db_url])) {
            REST::fatal(REST::HTTP_BAD_REQUEST, "You need to specify a database URL");
        }
        $database = $_POST[$this->db_url];
        // File uploads
        $filecounter = 0;
        foreach ($this->files as $input => $required) {
            if (Portal::isUploaded($input)) {
                if (!move_uploaded_file($_FILES[$input]['tmp_name'], $sandbox . $filecounter)) {
                    REST::fatal(REST::HTTP_INTERNAL_SERVER_ERROR, "Couldn't store uploaded file.");
                }
                $bashstring .= " -{$input} \"\${INDIR}{$filecounter}\"";
                $filecounter++;
            } else {
                if ($required) {
                    REST::fatal(REST::HTTP_BAD_REQUEST, "Missing required file {$input}");
                }
            }
        }
        // Check flags
        foreach ($this->flags as $flag) {
            if (!empty($_POST[$flag])) {
                $bashstring .= " -{$flag}";
            }
        }
        // Check params
        foreach ($this->params as $paramname => $defaultvalue) {
            if (isset($_POST[$paramname]) && strlen($_POST[$paramname]) && $_POST[$paramname] != $defaultvalue) {
                $bashstring .= " -{$paramname} " . escapeshellarg($_POST[$paramname]);
            }
        }
        $bashcode = $bashstring . " || exit 2";
    }