- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can not upload pdf in Content -> Block
Hi guys,
How are you guys ?
I hope everything is okay
I can't upload the pdf in the Menu Content -> Block
Can anyone help me?
Here is the screenshoot :
Thanks and Rgds,
Bintang
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Can not upload pdf in Content -> Block
Can you share the link of the screenshot as it is not approved yet.
In the meantime please follow the below link mentioned and let me know in case you face any issues.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Can not upload pdf in Content -> Block
Hi @rahul Gupta ,
Can you see the screenshot now?
Thanks for your feedback.
I have tried it before but it still doesn't work.
Maybe there is another way ?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Can not upload pdf in Content -> Block
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Can not upload pdf in Content -> Block
Hi @Rahul Gupta
I have followed your solution but it's still not working.
di.xml
Is there still something wrong?
Thank you
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Can not upload pdf in Content -> Block
Not able to see the image as it will be visible once approved.
In the meantime can you please confirm if you have created the custom module and done the changes in that and after that have you run the required commands to install the module?
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Can not upload pdf in Content -> Block
Hi @rahul Gupta ,
I previously made changes to the di.xml in /public_html/vendor/magento/module-cms/etc
<argument name="extensions" xsi:type="array"> <item name="allowed" xsi:type="array"> <item name="jpg" xsi:type="string">image/jpg</item> <item name="jpeg" xsi:type="string">image/jpeg</item> <item name="png" xsi:type="string">image/png</item> <item name="gif" xsi:type="string">image/gif</item> <item name="pdf" xsi:type="string">application/pdf</item> <item name="doc" xsi:type="string">application/msword</item> <item name="csv" xsi:type="string">text/plain</item> </item> <item name="image_allowed" xsi:type="array"> <item name="jpg" xsi:type="string">image/jpg</item> <item name="jpeg" xsi:type="string">image/jpeg</item> <item name="png" xsi:type="string">image/png</item> <item name="gif" xsi:type="string">image/gif</item> </item> <item name="media_allowed" xsi:type="array"> <item name="flv" xsi:type="string">video/x-flv</item> <item name="avi" xsi:type="string">video/x-msvideo</item> <item name="mov" xsi:type="string">video/x-sgi-movie</item> <item name="rm" xsi:type="string">application/vnd.rn-realmedia</item> <item name="wmv" xsi:type="string">video/x-ms-wmv</item> <item name="pdf" xsi:type="string">application/pdf</item> <item name="doc" xsi:type="string">application/msword</item> <item name="csv" xsi:type="string">text/plain</item> </item> </argument>
And then modify on function upload_file() at Storage.php in /public_html/vendor/magento/module-cms/Model/Wysiwyg/Images
here is my additional script snippet:
// ACTUAL CHANGE : if (strtolower($uploader->getFileExtension()) !== 'pdf') { // create thumbnail $this->resizeFile($targetPath . '/' . $uploader->getUploadedFileName(), true); } $result['cookie'] = [ 'name' => $this->getSession()->getName(), 'value' => $this->getSession()->getSessionId(), 'lifetime' => $this->getSession()->getCookieLifetime(), 'path' => $this->getSession()->getCookiePath(), 'domain' => $this->getSession()->getCookieDomain(), ]; return $result;
And clear cache via terminal in WHM cPanel..
$ php bin/magento cache:clean
Please correct me first, am i correct ?
Thanks