- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I try to upload an image in a category I am getting below error.
The issue I found is that the function in the file 'vendor\magento\module-catalog\Model\ImageUploader.php'
public function saveFileToTmpDir($fileId)
is called two times. One with the parameter 'image' and then with the parameter 'thumb_nail'. The error happens when it is called with the parameter 'thumb_nail'. I couldn't find where that function is getting called. It is supposed to be called from the controller 'vendor\magento\module-catalog\Controller\Adminhtml\Category\Image\Upload.php'. But when I comment out the code in the controller it is still being called. And it is supposed to be called one time with the parameter 'image'
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The issue was that the theme was overriding the Magento's default controller.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The theme controller was overriding the Magento controller. I have modified the controller and fixed the issue.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Error while uploading category image
Hi @akhilesh4u66f7,
There are various possible reasons that Magento 2 images are not uploading or not showing on the Admin. However, you can try to follow the below ways to fix the error when uploading an image on Magento 2.
Run Re-index Magento Data:
After the import, you might find that uploaded images are not visible at the Admin. It is because some image upload needs to be re-index for the changes to be applied.
Naivgate to System > Index management > Select all > Actions > Update from the save.
Clear the Cache from Cache Management:
You must try to clear your Magento cache and your browser cache,
- Firstly, log in to your Magento Admin.
- Then, navigate to System > Cache management > Flush Magento cache.
Check image roles are assigned to get visible on Admin:
- You can check the assigned roles from the Admin via the below path.
- Open Product Information > Image Details.
- Lastly, check "Hide from Product Page" option is not selected.
/vendor/magento/module-theme/view/adminhtml/ui_component/design_config_form.xml
From: <field name="header_logo_src" formElement="fileUploader"> To: <field name="header_logo_src" formElement="imageUploader"> From: <field name="head_shortcut_icon" formElement="fileUploader"> To: <field name="head_shortcut_icon" formElement="imageUploader">Check PHP memory limit:
Then, go to the Magento root directory and run the following command,
php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy -f php bin/magento indexer:reindex php bin/magento cache:clean
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content