cancel
Showing results for 
Search instead for 
Did you mean: 

File validation failed

SOLVED

File validation failed

I can't upload images using WYSIWYG,  as I get this error - File validation failed

My hosting provider has checked for permissions and they are fine.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: File validation failed

I did the following

public_html/vendor/magento/framework/File/Uploader.php
Find and delete
return $this->fileMime->getMimeType($this->_file['tmp_name']);

Worked a treat

View solution in original post

22 REPLIES 22

Re: File validation failed

Hello @jm0452

 

are you uploading which type of files?

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: File validation failed

I am uploading jpg files. It looks like its uploading but nothing appears in the folder

Re: File validation failed

I am using Magento 2.2.5

Re: File validation failed

Hello @jm0452,

 

That is an issue in Magento 2.2.5 version. Already created an issue for it https://github.com/magento/magento2/issues/16531

 

Please review it, might be you get an solution.

Re: File validation failed

I did the following

public_html/vendor/magento/framework/File/Uploader.php
Find and delete
return $this->fileMime->getMimeType($this->_file['tmp_name']);

Worked a treat

Re: File validation failed

src: https://github.com/magento/magento2/issues/16531/#issuecomment-404671271

Same problem here after updating to 2.2.5.

I was able to track my problem to Magento/Framework/File/Uploader.php:

private function _getMimeType()
     {
          return $this->fileMime->getMimeType($this->_file['tmp_name']);
     }

The temporary file name stored in $this->_file['tmp_name'] does not have an extension so Mime type returned will not be correct. I was able to solve my issue by going back and use return $this->_file['type'];

Re: File validation failed

Same error in magento 2.2.6

Re: File validation failed

i installed a demo with content in 2.2.6 and experienced the same issue, however, after installing "PHP Fileinfo module" it works, looks like that module is also required Smiley Happy

Re: File validation failed

Thanks for Sharing.. Really time saved after reading this..  Smiley Happy


@PaginasWebdotPE wrote:

i installed a demo with content in 2.2.6 and experienced the same issue, however, after installing "PHP Fileinfo module" it works, looks like that module is also required Smiley Happy