Jump to content

upload product image


JBarros

Recommended Posts

I've installed version 1.6 alpha and I'm also unable to upload images.

 

I switched error reporting on and I receive a "JSON.parse: unexpected character" error under the upload button after it is pressed.

 

The server response causing this is:

<br />
<b>Notice</b>:  Undefined index: save_path in <b>/home/bob/public_html/controllers/admin/AdminProductsController.php</b> on line <b>3657</b><br />
{"file":[{"tmp_name":"\/tmp\/phpoVVkBy","name":"product_test.jpg","size":0,"type":"image\/jpeg","error":"An error occurred while copying the image."}]}

Any ideas on how to fix this?

Do I need to set "save_path" somewhere in the config?

 

 

Link to comment
Share on other sites

Of course I meant 1.6.0.1 .. sorry. Your problem seems to be similar to the problem posted here:
http://www.prestashop.com/forums/topic/294845-upload-product-images-does-not-work/?p=1489958

On git there has been an update in the uploader script on git
https://github.com/PrestaShop/PrestaShop/commit/2a1c991612c7b7d48f819b55f31218c93c5509fd
Not sure if this will have an impact but maybe worth a try ...

Edited by prestamax (see edit history)
Link to comment
Share on other sites

Of course I meant 1.6.0.1 .. sorry. Your problem seems to be similar to the problem posted here:

http://www.prestashop.com/forums/topic/294845-upload-product-images-does-not-work/?p=1489958

 

On git there has been an update in the uploader script on git

https://github.com/PrestaShop/PrestaShop/commit/2a1c991612c7b7d48f819b55f31218c93c5509fd

Not sure if this will have an impact but maybe worth a try ...

 

Thank you for your help @prestamax.  I tried both the fix from GitHub and commenting out classes/ImageManager.php line 132, neither of those changes seemed to work for me, however, you did point me in the right direction and I managed to get it working!

 

Turns out my filesize was reporting back as 0!

 

In classes/Uploader.php line 171 change:

			$file_size = $this->_getFileSize($file_path);

to:

			$file_size = $this->_getFileSize($file_path, true);

This change forces PrestaShop obtain the file size from the file on disk instead of looking at the 'statcache' which consequently means that the filesize check on line 173 will pass (providing the file was moved ok due to file permissions) and the ['save_path'] element is set correctly so my image upload now works perfectly!

 

I don't full understand the inner workings so this is probably more of a hack than a fix as there could be a deeper reason why the cached value is not correctly set at this point.

 

I would be interested to know if this change also works for @barros77 too.

Link to comment
Share on other sites

Thank you for your help @prestamax.  I tried both the fix from GitHub and commenting out classes/ImageManager.php line 132, neither of those changes seemed to work for me, however, you did point me in the right direction and I managed to get it working!

 

Turns out my filesize was reporting back as 0!

 

In classes/Uploader.php line 171 change:

			$file_size = $this->_getFileSize($file_path);

to:

			$file_size = $this->_getFileSize($file_path, true);

This change forces PrestaShop obtain the file size from the file on disk instead of looking at the 'statcache' which consequently means that the filesize check on line 173 will pass (providing the file was moved ok due to file permissions) and the ['save_path'] element is set correctly so my image upload now works perfectly!

 

I don't full understand the inner workings so this is probably more of a hack than a fix as there could be a deeper reason why the cached value is not correctly set at this point.

 

I would be interested to know if this change also works for @barros77 too.

@shamanix i have make the change and it works now

Link to comment
Share on other sites

×
×
  • Create New...