skip to Main Content

I am working in Magento 2.3.3 and
when I add/edit product from admin in Magento 2 and trying to upload PNG and JPG image then I get an error message:

image was not uploaded. Disallowed File Type.

I set permission to 777 to pub/static folder but not getting success.

Here is the sceenshot

How can I upload images?

2

Answers


  1. I’m also faced the same problem..

    Problem has solved let me share solution hare

    there was no any problem with any permission. I have just changed a code in uploader.php folder

    went to directory : public_html/vendor/magento/framework/File/uploader.php

    and replace a line in uploader.php : ( return $this->fileMime->getMimeType($this->_file[‘tmp_name’]); )with ( return $this->_file[‘type’]; )

    Now my image upload in working fine

    Try this maybe this work for you.

    Login or Signup to reply.
  2. magento version 2.3
    Solution is editing,

    if ($uploader->checkMimeType($this->getAllowedMimeTypes())) {

    to

    if (!$uploader->checkMimeType($this->getAllowedMimeTypes())) {

    in magento/module-catalog/Controller/Adminhtml/Product/Gallery/Upload.php core file

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search