How to Allow more file types Magento

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.

Comments

  1. Henry Roger says:

    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

  2. Jackey says:

    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/

  3. Ton says:

    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?

  4. waddelljb says:

    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.

    1. Rick says:

      Thanks for the feedback, glad it worked!

  5. Ronald says:

    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.

  6. iel says:

    i just tested this on Magento ver. 1.7.0.2 and it doesn’t seem to work?

    1. Rick says:

      I haven’t had the chance to try it in that version 🙁

  7. JMLeon says:

    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?

    1. quicoto says:

      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/

Leave a Reply

Your email address will not be published. Required fields are marked *