I am writing a small script to upload and detect MIME type, using Zend Framework. For the design purpose, I can’t use Zend_Form but normal instead. And I simply apply from the manual :
$adapter = new Zend_File_Transfer_Adapter_Http();
$files = $adapter->getFileInfo();
$mime = $files->getMimeType();
But the system inform that the funcion getMimeType() does not existed. Then, I tried:
$adapter = new Zend_File_Transfer();
$files = $adapter->getFileInfo();
$mime = $files->getMimeType();
This time, it didn’t work either. So, how can I get the MIME type ?
Thank you so much for your help
I believe
$filesin both of your snippets would just be a simplearray, and each element should contain a key to indicate the type, like so:The
Zend_File_Transfer_Adapter_Abstractclass defines the code for determining the MIME type. It depends onFileinfoclass/extension or themime_content_type()function (part of an older version ofFileinfo, I believe).https://www.php.net/manual/en/book.fileinfo.php
PHP 5.3 includes
Fileinfoby default. Versions prior to 5.3 require the use of the PECL extension:http://pecl.php.net/package/Fileinfo