cancel
Showing results for 
Search instead for 
Did you mean: 

Disallowed File Type. when upload product image

SOLVED

Disallowed File Type. when upload product image

Hi There,

I have installed fresh magento 2.3 and install clue theme in that everything is working fine but when i am going to upload product image it is showing Disallowed File Type error. I have tried jpg and png sinple files  can someone help me how can i solve that issue. 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Disallowed File Type. when upload product image

Hi @Rahul Gupta 

Thanks for cooperation 

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 

Thanks to @Rahul Gupta  to giving me hints. 

 

 

View solution in original post

9 REPLIES 9

Re: Disallowed File Type. when upload product image

@gunjeet_singh please use the below command and check if it is working fine.

 

chmod 777 -R pub/media

thanks

Re: Disallowed File Type. when upload product image

Hi

@rahul Gupta thanks Rahul I have gave the 777 permission to  

pub/media

folder but still it is showing same error on product image upload and now when i check my server error log it is showing the error 

"[Thu Dec 12 02:33:23.632291 2019] [authz_core:error] [pid 12509] [client 119.18.62.96:54312] AH01630: client denied by server configuration: /home/voilaux/public_html/app/etc/config.php "

do you have any solution for that 

thanks for your reply @rahul Gupta 

Re: Disallowed File Type. when upload product image

@gunjeet_singh can you please try by giving 777 permission to etc folder if your website is not in production mode.

 

Thanks

Re: Disallowed File Type. when upload product image

Hi @Rahul Gupta 

I have already tried 777 permission to etc folder but still i am facing the same problem "Disallowed File Type." in product image uploading  and server log is giving same error  

"[Fri Dec 13 04:01:36.562991 2019] [authz_core:error] [pid 24005] [client 119.18.62.96:32938] AH01630: client denied by server configuration: /home/voilaux/public_html/app/etc/config.php "

Please tell me something I am stuck. 

Re: Disallowed File Type. when upload product image

Hi @Rahul Gupta 

Thanks for cooperation 

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 

Thanks to @Rahul Gupta  to giving me hints. 

 

 

View solution in original post

Re: Disallowed File Type. when upload product image

Saved my day

Re: Disallowed File Type. when upload product image

That change to Uploader.php did in fact work, but changing files in the vendor directory is not recommended. I found on the link below that the "disallowed file type" error in my case was due to a php fileinfo extension that needed to be enabled on the server: https://magento.stackexchange.com/questions/127586/magento-2-can-not-upload-product-images

 

Hope this helps 

Re: Disallowed File Type. when upload product image

I tried same but no luck.

 

Finally, I traced and solved. I was using .epub file for book (Downloadable Products).

Magento support following mime types only.

'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',

 

I added epub for _allowedMimeTypes array. My Problem solved. I recommending do use standard methodology instead of directly changing it into a core files.

 

If you are uploading such disallow mime-types then this solution will be worked for you.

Re: Disallowed File Type. when upload product image

I find the solutions. let me share steps

Firs open the cli and run chmod 777 -R var/ pub/ generated/

then flush the cache and check

Anees