JBarros Posted December 4, 2013 Share Posted December 4, 2013 I have instal prestashop 1.6 for test , but when i upload product image the image dont appear . any solution? Link to comment Share on other sites More sharing options...
shamanix Posted December 8, 2013 Share Posted December 8, 2013 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 More sharing options...
prestamax Posted December 9, 2013 Share Posted December 9, 2013 Are you using prestashop 1.6 or 1.6.1? I have just tried with my local test install (1.6.1) and could upload images without any problems. Link to comment Share on other sites More sharing options...
shamanix Posted December 12, 2013 Share Posted December 12, 2013 Are you using prestashop 1.6 or 1.6.1? I have just tried with my local test install (1.6.1) and could upload images without any problems. It says 1.6.0.1 in the footer of the admin section which I beleive is the latest alpha version. Link to comment Share on other sites More sharing options...
prestamax Posted December 12, 2013 Share Posted December 12, 2013 (edited) 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=1489958On git there has been an update in the uploader script on githttps://github.com/PrestaShop/PrestaShop/commit/2a1c991612c7b7d48f819b55f31218c93c5509fdNot sure if this will have an impact but maybe worth a try ... Edited December 12, 2013 by prestamax (see edit history) Link to comment Share on other sites More sharing options...
shamanix Posted December 12, 2013 Share Posted December 12, 2013 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 More sharing options...
JBarros Posted December 20, 2013 Author Share Posted December 20, 2013 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 More sharing options...
Recommended Posts