Workaround buggy mime_content_type on php 5.2.0+etch10 (not tested on other version).
[platal.git] / classes / plupload.php
index 155a8a4..1911ab9 100644 (file)
@@ -66,6 +66,9 @@ class PlUpload
     {
         if ($this->exists()) {
             $this->type = trim(mime_content_type($this->filename));
+            if ($this->type == 'text/plain') { // Workaround a bug of php 5.2.0+etch10 (mime_content_type fallback is 'text/plain')
+                $this->type = trim(exec("file -bi " . escapeshellarg($this->filename)));
+            }
         }
     }