$importIdent = true; $importImage = true; //Sanitation if (!$uspid || !preg_match('/^[0-9,]+$/', $uspid)) { exit('ERROR: illegal upload profile identifier '); } $duManager = new SpecUploadDwca(); $duManager->setVerboseMode(2, 'batchDwcaUpload'); $duManager->setIncludeIdentificationHistory($importIdent); $duManager->setIncludeImages($importImage); $uspidArr = explode(',', $uspid); foreach ($uspidArr as $uploadId) { //Initiate parameters $duManager->setUspid($uploadId); $duManager->readUploadParameters(); $duManager->setSourceDatabaseType('batchDwcaUpload'); if ($duManager->getTitle() == '') { exit('ERROR: unable to set upload profile data (uspid: ' . $uploadId . ')'); } if ($duManager->getCollInfo('managementtype') != 'Snapshot') { exit('ERROR: automatic updates only allowed for Snapshot collections'); } $duManager->loadFieldMap(true); $ulPath = $duManager->uploadFile(); if (!$ulPath) { exit('ERROR uploading file: ' . $duManager->getErrorStr()); } if (!$duManager->analyzeUpload()) { exit('ERROR analyzing upload file: ' . $duManager->getErrorStr()); } if (!$duManager->uploadData(false)) {
$duManager->setIncludeImages($importImage); if ($filePath) { $duManager->setPath($filePath); } //For now, assume DWCA import is a specfy database if (!$sourceType) { $sourceType = 'specify'; } } else { exit('ERROR: illegal upload type = ' . $uploadType . ' (should be 3 = File Upload, 6 = DWCA upload)'); } if (!$duManager->validateSecurityKey($securityKey)) { exit('ERROR: security key validation failed!'); } if ($sourceType) { $duManager->setSourceDatabaseType($sourceType); } $duManager->setVerboseMode(2); $duManager->loadFieldMap(true); $ulPath = $duManager->uploadFile(); if (!$ulPath) { exit('ERROR uploading file: ' . $duManager->getErrorStr()); } if (!$duManager->analyzeUpload()) { exit('ERROR analyzing upload file: ' . $duManager->getErrorStr()); } if (!$duManager->uploadData(false)) { exit('ERROR uploading file: ' . $duManager->getErrorStr()); } $transferCnt = $duManager->getTransferCount(); $duManager->finalTransfer();