Skip to content

Commit

Permalink
Fix mime type check to allow re-upload of downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
nearwood committed Oct 31, 2019
1 parent 85e06f2 commit 0a1be8f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ function checkUploads($files)

//Get and check mime types (ignoring provided ones)
$finfo = new finfo(FILEINFO_MIME_TYPE);
if ($finfo->file($file['tmp_name']) != "application/xml")
$mimeType = $finfo->file($file['tmp_name']);
if ($mimeType != "application/xml" && $mimeType != "text/xml")
{
if (DEBUG) warn('File: ' . $file['tmp_name'] . ': Invalid MIME type ' . $mimeType);
unset($files[$index]);
continue;
}
Expand All @@ -95,7 +97,7 @@ function checkUploads($files)
else
echo '<div class="info">' . count($files) . ' files were uploaded.</div>';

if (DEBUG) debug('<div class="debug">Adding engine: ' . $_POST['make'] . ', ' . $_POST['code'] . ', ' . $_POST['displacement'] . ', ' . $_POST['compression'] . ', ' . $_POST['aspiration'] . '</div>');
if (DEBUG) debug('Adding engine: ' . $_POST['make'] . ', ' . $_POST['code'] . ', ' . $_POST['displacement'] . ', ' . $_POST['compression'] . ', ' . $_POST['aspiration']);

$engineid = $msqur->addEngine($_POST['make'], $_POST['code'], $_POST['displacement'], $_POST['compression'], $_POST['aspiration']);
$fileList = $msqur->addMSQs($files, $engineid);
Expand Down

0 comments on commit 0a1be8f

Please sign in to comment.