Enable pdf extension on WYSIWYG for Magento
Came across other day the need to upload pdf files through the WYSIWYG tool on Magento. I’ve checked the native functionality and it allows by default only images (jpg, png, gif).
So, to change the initial behavior I opened the file app/code/core/Mage/Cms/etc/config.xml, which defines the filetypes that can be uploaded, and around line 110 I’ve added the line <pdf>1</pdf> as below:
Clean your Cache Management > Configuration, then you can open again your WYSIWYG (which can be done through CMS > Pages > Select One Page > Tab Content) and click on the bottom “Insert Image” (as below) and you show be able to upload your pdfs by now.
You should also change the your code as below if you want the Image Button on the WYSIWYG enable:
This changes will affect the button in the image:
Here we enabled .pdf, however keep in mind that it can also be done for any other kind of extension.
UPDATE 26/06/2015: Please take in consideration to copy the file app/code/core/Mage/Cms/etc/config.xml into app/code/local/Mage/Cms/etc/config.xml. Once changing core files are not recommended.