Commit dce7a1125e5694e530d201854080e36770a89395
1 parent
2ce81fb1
Set the MIME type for documents as they are added.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4215 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
3 additions
and
0 deletions
lib/documentmanagement/documentutil.inc.php
| @@ -420,6 +420,9 @@ class KTDocumentUtil { | @@ -420,6 +420,9 @@ class KTDocumentUtil { | ||
| 420 | $sFilename = tempnam('/tmp', 'kt_storecontents'); | 420 | $sFilename = tempnam('/tmp', 'kt_storecontents'); |
| 421 | $oOutputFile = new KTFSFileLike($sFilename); | 421 | $oOutputFile = new KTFSFileLike($sFilename); |
| 422 | $res = KTFileLikeUtil::copy_contents($oContents, $oOutputFile); | 422 | $res = KTFileLikeUtil::copy_contents($oContents, $oOutputFile); |
| 423 | + $sType = KTMime::getMimeTypeFromFile($sFilename); | ||
| 424 | + $iMimeTypeId = KTMime::getMimeTypeID($sType, $sFilename); | ||
| 425 | + $oDocument->setMimeTypeId($iMimeTypeId); | ||
| 423 | if (!$oStorage->upload($oDocument, $sFilename)) { | 426 | if (!$oStorage->upload($oDocument, $sFilename)) { |
| 424 | return PEAR::raiseError("Couldn't store contents"); | 427 | return PEAR::raiseError("Couldn't store contents"); |
| 425 | } | 428 | } |