cancel
Showing results for 
Search instead for 
Did you mean: 

Magento v2.x Error in Backend Sometimes While Uploading Images or Attachments

Magento v2.x Error in Backend Sometimes While Uploading Images or Attachments

Hello,

 

We are using magento v2 and we are facing an error. When ever we are  uploading images or datasheet, we get this error like attached in email below. The addition process was working find till half of the last month but we started to receive this afterwards.

 

Please do assist

 

Screenshot 2022-05-23 101807.jpgScreenshot 2022-05-23 105619.jpgScreenshot 2022-05-23 121706.jpgWhatsApp Image 2022-05-23 at 10.56.35 AM.jpegWhatsApp Image 2022-05-23 at 12.17.18 PM.jpeg

1 REPLY 1

Re: Magento v2.x Error in Backend Sometimes While Uploading Images or Attachments

Hello,

 

I hope you are doing well!

 

Try to redeploy static content. Connect server via SSH and goto Magento root directory. 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

 

Just use chmod() after your upload functions.. <?php /* * All your upload code here; then pass the filename * and the base permissions to the chmod() below */ chmod($uploadedFile, 0777);

 

Re-Index Magento Data:

 

It can also be a big issue that is causing an error While Uploading Images or Attachments. 

In order to fix this, reindex all the data in Magento.

Go to System-> Index management -> Select all -> Actions -> Update from the save

 

Clear the Magento Cache from Cache Management:

 

The Magento backend often gives an error while uploading Images or Attachments due to caching issues. For this, you will have to log in to your Magento Admin and then go to System-> Cache management-> Flush Magento cache.

 

If you are adding images via import, make sure your import file contains appropriate column titles for image roles:

  • base_image - for base image
  • small_image - for a small one
  • thumbnail_image - for thumbnail
  • additional_images - for all other images separated by a comma: 2.png,3.png,4.png

 

Check maximum file and post sizes:

By default, Magento's maximum file upload size is 2M. So when trying to upload bigger pictures, you can get the message: Insufficient max file size and post file size.

Try to optimize your images to make them weigh less. If you need to upload a large image, you must increase upload_max_filesize and post_max_size in the php.ini file. Mind that some hosting companies don't allow larger file and post size values, so you should better clarify it with your host. Also, you should remember that post_max_size has to be the same or greater than upload_max_filesize.

 

I hope these fixes help you to encounter the problem related to the Backend error.

 

------------------------

Regards,

Rex M