Allow more file types to Magento.
I wanted to add a PDF file to the product description but Magento just allow image file types.
Let's get started.
Core Files
Look for the file: /app/code/Core/Mage/Cms/etc/config.xml
You should create the same folder structure inside /app/local/...
That's the way to make the change upgrade proof. But I did and didn't work ๐
Add the extensions
Open the config.xml I mentioned above and around the line 100 you will find something like this:
<extensions>
<allowed>
<jpg>1</jpg>
<jpeg>1</jpeg>
<png>1</png>
<gif>1</gif>
<pdf>1</pdf>
</allowed>
<image_allowed>
<jpg>1</jpg>
<jpeg>1</jpeg>
<png>1</png>
<gif>1</gif>
</image_allowed>
<media_allowed>
<flv>1</flv>
<swf>1</swf>
<avi>1</avi>
<mov>1</mov>
<rm>1</rm>
<wmv>1</wmv>
</media_allowed>
</extensions>
Code language: HTML, XML (xml)
Please notice I added <pdf>1</pdf> to the allowed extensions.
After uploading the file refresh the Magento Cache and also try to log out from the Magento Admin panel.
JMLeon
So when you add a PDF to any product, you have it with the pictures in the product view or you can put it in the template wherever you want?
quicoto
You can add the PDF to anywhere you can write.
The description or short description.
Just open the HTML editor, create a LINK and upload the file ๐
Rember this is just a normal attachment. You can create Downloadable Products:
https://ricard.dev/how-to-create-downloadable-products-magento/
iel
i just tested this on Magento ver. 1.7.0.2 and it doesn’t seem to work?
Rick
I haven’t had the chance to try it in that version ๐
Ronald
What about more file types on downloadable products? Some extensions not allowed.. like php/html/js etc. I don’t see those controlled via XML.
waddelljb
Worked OK with Magento 1.7.0.2 when using in WYSIWG editor to link images and text to PDF files using standard html and the link feature in editor. PDF files will now up load into storage.
Thanks a lot for a simple but clever tip.
Remember to log out and login.
Rick
Thanks for the feedback, glad it worked!
Ton
Magento ver. 1.8.1.0 copy to local/Mage/Cms/etc/config.xml , doesn’t work even clear cache and logout.
But change in core/Mage/Cms/etc/config.xml working. Is it good to change in core?
Jackey
I found this solution that works without having to modify the core file:
http://prattski.com/2011/01/10/magento-allow-other-file-types-in-wysiwyg-editor/
Henry Roger
Hi Jackey,
I was looking for a solution to upload PDF/zip files in WYSIWYG editor but the link you have posted can’t be found. Can you help me with it? Currently I am using the following extension to upload PDF and other file types in Magento 2.
https://www.fmeextensions.com/product-attachments-file-uploads-magento-2.html