From f423684b5303b4196c8c728eb06cbd6eb9aad8b1 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Sun, 2 Oct 2011 19:30:37 -0700 Subject: Merged file mime type detection from 1.7. --- mod/file/actions/file/upload.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'mod/file/actions') diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php index 88a01745d..ee2889b4c 100644 --- a/mod/file/actions/file/upload.php +++ b/mod/file/actions/file/upload.php @@ -90,10 +90,11 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { $filestorename = elgg_strtolower(time().$_FILES['upload']['name']); } - $file->setFilename($prefix.$filestorename); - $file->setMimeType($_FILES['upload']['type']); + $mime_type = $file->detectMimeType($_FILES['upload']['tmp_name'], $_FILES['upload']['type']); + $file->setFilename($prefix . $filestorename); + $file->setMimeType($mime_type); $file->originalfilename = $_FILES['upload']['name']; - $file->simpletype = file_get_simple_type($_FILES['upload']['type']); + $file->simpletype = file_get_simple_type($mime_type); // Open the file to guarantee the directory exists $file->open("write"); -- cgit v1.2.3