Magento2: Allow PDF file upload to Magento media library via WYSIWYG

Created on 5 Jun 2017  路  19Comments  路  Source: magento/magento2

As a Magento Admin User I want to upload PDF file to Magento media library and insert the reference (link) to it in the content via WYSIWYG

Acceptance Criteria

  • Allow to upload PDF files and images to Media gallery via Insert File button
    insertfilebutton
  • Allow upload PDF files and images to Media gallery via Insert File button in WYSIWYG
    fileuploadiconredactor
  • PDF icon is displayed for uploaded PDF documents in the Media gallery dialog
    pdf-icon
  • PDF documents are displayed in the Media gallery dialog in the following format: PDF icon, file name (document name)
  • PDFs are mixed with images in Media Gallery in the Insert File dialog
  • Only Image files are displayed in the Insert Image dialog
  • Dialog window title for Insert Image has a title: Insert Image and button Insert Image
    insertimagedialog
  • Dialog window title for Insert File has a title: Insert File... and button Insert File insertfiledialog
  • Anchor code is generated when inserting PDF document in the following format:
    <a href="{{media url="wysiwyg/Document.pdf"}}" title="Document">Document</a>
    where Document.pdf is a file name , Document - is a document name

    • Anchor code is generated when inserting image via _Insert File_ dialog:

      <a href="{{media url="wysiwyg/image.xxx"}}" title="Image">Image</a>

      where Image is a file name , xxx - image type extension

Assets
PDF icon: pdf

Upload Icon: upload

Format is not valid up for grabs

Most helpful comment

I am working on this issue.

All 19 comments

@okorshenko , hope you doing well. :)

Can we add a docx file as a document.

Suppose, Document.docx is a file name , Document - is a document name

<a href="{{media url="wysiwyg/Document.docx"}}" title="Document">Document</a>

Then will it ok or not?

How to enable pdf file upload for page/block WYSIWYG on 2.1.6?

Sounds good @devamitbera ,

@okorshenko what do you think about to extend this upload file to:

https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions
https://help.libreoffice.org/Common/XML_File_Formats

Maybe we can cover "standards" of files.

Open Question.

CC: Product Owner: @tkacheva

I would prefer to implement PDF files support first. Later, it will be very easy to add new file types to this functionality. Just add list of allowed extensions in di.xml and provide the icon for each file type.
Let's start from minimal required functionality. New features can be added in a separate tasks by different contributors.

@winds1983 we need to implement this for develop branch first. Later we will be able to backport this feature

@okorshenko @osrecio Let's start with making the list of file formats easy extendable and then work on adding extra file format support to the core.

No problem, I agree with this option. Make extensible for specific needs.

Hi @osrecio
Do you have any progress on this? Do you need some help?

I'm working on it. these weeks I'm very busy. But I will try looking gaps to commit some progress

I am working on this issue.

Hi @kumarshanu90 do you have any progress on that? Thank you

@okorshenko I do have this functionality as an extension so if you need this extension then please let me know.
using this extension you can upload any file type.
[email protected]
Thank you.

Hi @5mehulhelp5
Thank you. But it would be great if you can submit PR with this functionality and make it as a part of core code.

No activity. Closing the issue

Please reopen, this is a needed feature.

I agree.

@sdzhepa: can we move this to the feature request repository and re-open it?

I found a plugin that adds this potentially will try it out soon.
https://github.com/experius/Magento-2-Module-Experius-WysiwygDownloads

composer require experius/module-wysiwygdownloads
Works by the way I'm using Magento 2.3.2 although thumbnails are not showing.

Was this page helpful?
0 / 5 - 0 ratings