cancel
Showing results for 
Search instead for 
Did you mean: 

Disallowed file type when uploading in admin

SOLVED

Disallowed file type when uploading in admin

Hi,

 

I've created a module for m2.0, that basically asks for more information on the product. As such, I am able to request a couple files needed for my project. One of the files is giving me 'Disallowed file type.' error upon saving the product.

 

My module has a tab on the basic product area. There, I am able to add sets of data that will have files that are not images.

 

I've followed this tutorial to understand how to do most of my intended features:

https://snow.dog/blog/tutorial-how-to-implement-an-admin-product-tab-in-magento-2/

 

and I have:

$uploader->setAllowedExtensions($this->allowedExtensions);

protected $allowedExtensions = ['pdf', 'obj'];

 

Can anyone help me get over this issue? Spent a couple hours already and haven't found anything that was able to help me out.

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Disallowed file type when uploading in admin

Had this line on the $uploader:

 

//$uploader->addValidateCallback('product', $imageAdapter, 'validateUploadFile');

 

Commenting it makes it work.

Further research on that validateUploadFile callback needed!

View solution in original post

2 REPLIES 2

Re: Disallowed file type when uploading in admin

Had this line on the $uploader:

 

//$uploader->addValidateCallback('product', $imageAdapter, 'validateUploadFile');

 

Commenting it makes it work.

Further research on that validateUploadFile callback needed!

Re: Disallowed file type when uploading in admin

1. image file should be jpg format . because getImageSize() search for width and height of image .

2. mention only image names in csv files.

3.mention directory in image directory opton of import tab.