Jump to content

Can't upload product images on Prestashop 1.7.6.5


cpuin

Recommended Posts

Hi,

Before posting here I have read several topics, but they were for other versions of Prestashop and non of them have solved my problem.

I'm using Prestashop 1.7.6.5 and since few days I'm unable to upload product images.I got this error 500 (see the attachment).

I have contacted the support of my hosting and they also have tried everything and have assured me that they haven't made any changes.

What I have tried is:

- regenerate .htaccess disabling Frindly URL and enable them again. - didn't work

- clear all caches incl. smarty - didn't work

 

What from the hosting told me is that Prestashop can't find /tmp temporary folder to write or something like this.

Many thanks in advance to all of you!

 

Screenshot 2024-07-14 at 17.00.23.png

Link to comment
Share on other sites

Hi,

Please enable the debug mode and then share the error that occurs while uploading an image from the network panel.

If the error is related to the temp file Not Found,

Please try adding the following code snippet:
file_put_contents($_FILES['image_product']['tmp_name'], Tools::file_get_contents($_FILES['image_product']['tmp_name']));

Insert this code into the addProductImage() function located in:
/controllers/admin/AdminProductsController.php

For reference, please see the screenshot below:
https://prnt.sc/jgSP0VDfPzEO

After this, clear the cache and then try uploading the image again.

If the issue still persists, then please share screenshot of the error.

Link to comment
Share on other sites

I have added the line you have recommended in the beginning of the function you suggested.

Have cleared the cache and tried , but got the same error SERVER 500 like the screenshot I have attached initially.

When trying to switch to debug mode I got this error(see attachment) and rarely this file doesn't exist. 

Screenshot 2024-07-16 at 20.33.44.png

Link to comment
Share on other sites

15 minutes ago, Prestashop Addict said:

Oups, for performances issues it is not recommended to set the cache in mySQL 😞 You should prefer files.

I just have changed it to files. Anyway it didn't fix the problem.

Link to comment
Share on other sites

  • 1 month later...

The issue might be related to incorrect folder permissions or missing the /tmp directory. Try the following steps:

Check Folder Permissions: Ensure that the /img and /tmp directories have the correct permissions (usually 755 or 775).

Create /tmp Folder: Verify that the /tmp directory exists and is writable by the server. If it doesn’t exist, create it.

PHP Configuration: Ensure that the server's PHP configuration points to the correct temporary directory.

These steps should help resolve the image upload issue in Prestashop.null😇

Link to comment
Share on other sites

  • 2 weeks later...
On 7/24/2024 at 11:04 AM, cpuin said:

Many, Many thanks, updating this module has fixed the problem.

Dear All

I'm face the same issue . Could you explain me more what is module prestashop BUS . I can not find int in my prestashop in french.

 

regards

 

Cédric

Link to comment
Share on other sites

On 9/20/2024 at 6:52 AM, abbrio said:

The issue might be related to incorrect folder permissions or missing the /tmp directory. Try the following steps:

Check Folder Permissions: Ensure that the /img and /tmp directories have the correct permissions (usually 755 or 775).

Create /tmp Folder: Verify that the /tmp directory exists and is writable by the server. If it doesn’t exist, create it.

PHP Configuration: Ensure that the server's PHP configuration points to the correct temporary directory.

These steps should help resolve the image upload issue in Prestashop.null😇

Dear Abrrio

I try your upper proposal. regard the 2 first is OK

regarding the latest one  (PHP configuration) could you explain me how I can check this step?

 

regards

 

Cédric

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...