diff --git a/core/trunk/core/docservers_tools.php b/core/trunk/core/docservers_tools.php
index dad8bc3c2265b526a129844dfd0d5bd7e6084577..9b2da1e8a2ea29e828ad597f180002e81c97e427 100644
--- a/core/trunk/core/docservers_tools.php
+++ b/core/trunk/core/docservers_tools.php
@@ -477,7 +477,7 @@ function Ds_setRights($dest)
 }
 
 /**
-* get the mime type of a doc
+* get the mime type of a file with a path
 * @param $filePath path of the file
 * @return string of the mime type
 */
@@ -487,6 +487,17 @@ function Ds_getMimeType($filePath)
     return MIME_Type::autoDetect($filePath);
 }
 
+/**
+* get the mime type of a file with a buffer
+* @param $fileBuffer buffer of the file
+* @return string of the mime type
+*/
+function Ds_getMimeTypeWithBuffer($fileBuffer)
+{
+    $finfo = new finfo(FILEINFO_MIME);
+    return $finfo->buffer($fileBuffer);
+}
+
 /**
  * del tmp files
  * @param   $dir dir to wash