Community Support for OpenDocMan (Deprecated)
Bug - allowedFileTypes during Add operation - Printable Version

+- Community Support for OpenDocMan (Deprecated) (https://forum.opendocman.com)
+-- Forum: OpenDocMan Community Discussion (https://forum.opendocman.com/forum-5.html)
+--- Forum: OpenDocMan Bug Reports (https://forum.opendocman.com/forum-8.html)
+--- Thread: Bug - allowedFileTypes during Add operation (/thread-272.html)



Bug - allowedFileTypes during Add operation - Stephen - 06-04-2010

The add operation does not seem to be checking for allowed filetypes, but check-in does.


Re: Bug - allowedFileTypes during Add operation - Stephen - 06-04-2010

This is the fix for this issue:

Replace the foreach and the if($allowedFile) sections with the code below:

Code:
// check file type
    foreach($GLOBALS['allowedFileTypes'] as $thistype)
    {
        if ($_FILES['file']['type'] == $thistype)
        {
            $allowedFile = 1;
            break;
        }
        else
        {
            $allowedFile = 0;
        }
    }
    // illegal file type!
    if ($allowedFile != 1)
    {
        $last_message='MIMETYPE: ' . $_FILES['file']['type'] . ' Failed';
        header('Location:error.php?ec=13&last_message=' . urlencode($last_message));
        exit;
    }