diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2011-10-02 19:30:37 -0700 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2011-10-02 19:30:37 -0700 |
commit | f423684b5303b4196c8c728eb06cbd6eb9aad8b1 (patch) | |
tree | 5de8dfe913b2d43be0c713564fe9af70cc7c096e /mod/file | |
parent | 19277946b643c7024c1aaad813f287bead695f21 (diff) | |
download | elgg-f423684b5303b4196c8c728eb06cbd6eb9aad8b1.tar.gz elgg-f423684b5303b4196c8c728eb06cbd6eb9aad8b1.tar.bz2 |
Merged file mime type detection from 1.7.
Diffstat (limited to 'mod/file')
-rw-r--r-- | mod/file/actions/file/upload.php | 7 |
1 files changed, 4 insertions, 3 deletions
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"); |