icrosser Posted March 30, 2015 Share Posted March 30, 2015 Hi,I was using prestashop 1.3.7, today I tried a new site with prestashop 1.6.0.14 .While I got a problem during import csv files. it shows "Error copying image" I did everything carefully. I think maybe it's because of the images' name.There's space and symbols in the names.I tested with images name 1.jpg,2.jpg,3.jpg ,and they working well. Could anyone help me to resolve this problem ???Thank you a lot! Link to comment Share on other sites More sharing options...
tjtang Posted April 5, 2015 Share Posted April 5, 2015 (edited) I had this problem too after upgrading to 1.6.0.14 This happened because spaces in the URL for the image was decoded to + instead of %20 I noticed this additional code in /controllers/admin/AdminImportController.php around lines 1020 that wasn't there before the upgrade: $url = urldecode($url); $parced_url = parse_url($url); if (isset($parced_url['path'])) { $uri = ltrim($parced_url['path'], '/'); $parts = explode('/', $uri); foreach ($parts as &$part) $part = urlencode ($part); unset($part); $parced_url['path'] = '/'.implode('/', $parts); } if (isset($parced_url['query'])) { $query_parts = array(); parse_str($parced_url['query'], $query_parts); $parced_url['query'] = http_build_query($query_parts); } if (!function_exists('http_build_url')) require_once(_PS_TOOL_DIR_.'http_build_url/http_build_url.php'); $url = http_build_url('', $parced_url); Removing it worked for me. DISCLAIMER: This is probably not the right way to solve it and the problem will happen again with the next upgrade. You should probably use some override, or change some config in apache/php/nginx. If you do find the correct way to fix it, please let me know. Edited April 5, 2015 by tjtang (see edit history) 1 Link to comment Share on other sites More sharing options...
kennymelo Posted April 7, 2015 Share Posted April 7, 2015 I tried that but it still gives the same error. Link to comment Share on other sites More sharing options...
tuk66 Posted April 7, 2015 Share Posted April 7, 2015 Replace all spaces in the image files with, for example, dashes. If you are on Windows, Total Commander can do it in 10 seconds. Link to comment Share on other sites More sharing options...
icrosser Posted July 30, 2015 Author Share Posted July 30, 2015 I had this problem too after upgrading to 1.6.0.14 This happened because spaces in the URL for the image was decoded to + instead of %20 I noticed this additional code in /controllers/admin/AdminImportController.php around lines 1020 that wasn't there before the upgrade: $url = urldecode($url); $parced_url = parse_url($url); if (isset($parced_url['path'])) { $uri = ltrim($parced_url['path'], '/'); $parts = explode('/', $uri); foreach ($parts as &$part) $part = urlencode ($part); unset($part); $parced_url['path'] = '/'.implode('/', $parts); } if (isset($parced_url['query'])) { $query_parts = array(); parse_str($parced_url['query'], $query_parts); $parced_url['query'] = http_build_query($query_parts); } if (!function_exists('http_build_url')) require_once(_PS_TOOL_DIR_.'http_build_url/http_build_url.php'); $url = http_build_url('', $parced_url); Removing it worked for me. DISCLAIMER: This is probably not the right way to solve it and the problem will happen again with the next upgrade. You should probably use some override, or change some config in apache/php/nginx. If you do find the correct way to fix it, please let me know. Thank you a lot . This way resolved my problem perfectly. You the best . Thank you thank you thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now