I have the following array:
Array (
[0] => Information.pdf
[1] => Presentation.pdf
[2] => Brochure.pdf
)
I want to convert it into a nested array in the following format using PHP to make it compatible with the CakePHP 2.1.1 email class:
Array (
[Information.pdf] => Array (
[file] => /files/Information.pdf
[mimetype] => application/pdf
)
[Presentation.pdf] => Array (
[file] => /files/Presentation.pdf
[mimetype] => application/pdf
)
[Brochure.pdf] => Array (
[file] => /files/Brochure.pdf
[mimetype] => application/pdf
)
)
Any ideas on how to do this? The “mimetype” can be hardcoded.
For mimetype guessing, the fileinfo extension would be a good choice.