cancel
Showing results for 
Search instead for 
Did you mean: 

File validation failed

SOLVED
Highlighted

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
Highlighted

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

20 REPLIES 20
Highlighted

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
Highlighted

Re: File validation failed

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

Highlighted

Re: File validation failed

I am using Magento 2.2.5

Highlighted

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.

Highlighted

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

Highlighted

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'];

Highlighted

Re: File validation failed

Same error in magento 2.2.6

Highlighted

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

Highlighted

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