? Pending

User tests: Successful: Unsuccessful:

avatar csthomas
csthomas
4 Jul 2018

Pull Request for Issue #16086

Summary of Changes

A better way to check the MIME file type if the operating system is incorrectly configured.

If you still have a problem and your server is not running on Windows, test the following patch:

diff --git a/libraries/src/Helper/MediaHelper.php b/libraries/src/Helper/MediaHelper.php
index 60f7fab83d..99cb1d80e1 100644
--- a/libraries/src/Helper/MediaHelper.php
+++ b/libraries/src/Helper/MediaHelper.php
@@ -102,6 +102,12 @@ class MediaHelper
                                        $mime      = isset($imagesize['mime']) ? $imagesize['mime'] : false;
                                }
                        }
+
+                       // Last chance to get to know the type of mime
+                       if (!$mime && IS_UNIX && function_exists('exec') && function_exists('escapeshellarg'))
+                       {
+                               $mime = strtok(exec('file -bi ' . escapeshellarg($file)), ';');
+                       }
                }
                catch (\Exception $e)
                {

Testing Instructions

Try to upload pdf or image file.
Take a look at #16086

Please test if you still interested @goforitweb, @uglyeoin, @edthenet, @OrignlCin

Expected result

PDF file is recognized.

Actual result

#16086

Documentation Changes Required

No

avatar csthomas csthomas - open - 4 Jul 2018
avatar csthomas csthomas - change - 4 Jul 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 4 Jul 2018
Category Libraries
avatar csthomas csthomas - change - 4 Jul 2018
Labels Added: ?
avatar csthomas csthomas - change - 4 Jul 2018
The description was changed
avatar csthomas csthomas - edited - 4 Jul 2018
avatar csthomas csthomas - change - 4 Jul 2018
Title
Better check mime type of uploaded file
A better way to check MIME type of the uploaded file
avatar csthomas csthomas - edited - 4 Jul 2018
avatar csthomas
csthomas - comment - 18 Jul 2018

2 weeks and no interest, so I do not understand why I am trying to help someone.

avatar csthomas csthomas - close - 18 Jul 2018
avatar csthomas csthomas - change - 18 Jul 2018
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2018-07-18 09:43:54
Closed_By csthomas

Add a Comment

Login with GitHub to post a comment