Skip to content
Permalink
Browse files Browse the repository at this point in the history
bug fix 1
  • Loading branch information
bradymiller committed Oct 25, 2022
1 parent 03e06e4 commit 2e7678d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions controllers/C_Document.class.php
Expand Up @@ -274,7 +274,6 @@ public function upload_action_process()
}
$za->close();
if ($mimetype == "application/dicom+zip") {
$_FILES['file']['type'][$key] = $mimetype;
sleep(1); // Timing insurance in case of re-compression. Only acted on index so...!
$_FILES['file']['size'][$key] = filesize($_FILES['file']['tmp_name'][$key]); // file may have grown.
}
Expand All @@ -293,15 +292,23 @@ public function upload_action_process()
if ($_POST['destination'] != '') {
$fname = $_POST['destination'];
}
// set mime, test for single DICOM and assign extension if missing.
$mimetype = $_FILES['file']['type'][$key];
// test for single DICOM and assign extension if missing.
if (strpos($filetext, 'DICM') !== false) {
$mimetype = 'application/dicom';
$parts = pathinfo($fname);
if (!$parts['extension']) {
$fname .= '.dcm';
}
}
// set mimetype (if not already set above)
if (empty($mimetype)) {
$mimetype = mime_content_type($_FILES['file']['tmp_name'][$key]);
}
// if mimetype still empty, then do not upload the file
if (empty($mimetype)) {
$error = xl("Unable to discover mimetype, so did not upload " . $_FILES['file']['tmp_name'][$key]) . ".\n";
continue;
}
$d = new Document();
$rc = $d->createDocument(
$patient_id,
Expand Down

0 comments on commit 2e7678d

Please sign in to comment.