Jump to content

[SOLVED] Error copying image - importing products


editorstefan
 Share

Recommended Posts

I get error as you see below when i try to import products with image. Please help me solve this ASAP!

 

 

I have Prestashop 1.5.5

I write image url as http://www.mywebsite.com/img/p/import/I5-5658-1.jpg in the .csv file.

All images are uploaded to the "import" folder via FTP.

Folder import and p both have permission 777.

I import about 60 products with only 1 image per products.

 

Please is there anything i can do to import the products with images?

 

SOLUTION:

Open - Classes/Tools.php

 

Change line number 1408

 

From:

"return @copy($source, $destination, $stream_context);"

 

to:

"return @copy($source, $destination);"

 

It should work, it is a small bug in prestashop 1.5.5

 

Regards

Vivek Sakhilati

 

Edited by vekia (see edit history)

Share this post


Link to post
Share on other sites

Ask your host if you are running DSO php interpreter. Also, ask if mod security is enable, if they are ask them to disable both. 

 

Ok, i will call them in the morning. But can you explain what DSO php interpreter and mod security is? It's a swedish host so i need to know how to explain to them :) Thank you!

Share this post


Link to post
Share on other sites

DSO is a php interpreter, it sometimes causes permissions problems with Prestashop. Mod security is an apache module that causes issues saving to directories and opening files. It can only use relative urls and not the full path, so that is why it has problems.

Share this post


Link to post
Share on other sites

DSO is a php interpreter, it sometimes causes permissions problems with Prestashop. Mod security is an apache module that causes issues saving to directories and opening files. It can only use relative urls and not the full path, so that is why it has problems.

 

I have talked to them now and they turned MOD security off but they couldnt find ane DSO but they thought that may be beacuse it doesnt even exist on my server.

I have tried to import but it still doesnt work.. i get same error - PLEASE HELP!

Share this post


Link to post
Share on other sites

Just use your local host and install 1.5.5 then import your csv. Test it and see if it works and update us please. Thank you!

 

Ok i have done it and it's working :/ :/ 

In localhost i imported with EXACTLY same csv so the image url was from my actuall live server. http://www.mywebsite.com/img/p/import/I5-5658-1.jpg

 

Another guy has sam problem and hes 1.5.4 works good on same server but 1.5.5 don't. 

Maybe 1.5.5 doesn't work on live servers for some reason or any idea why?

Share this post


Link to post
Share on other sites

Same problem here.


I have just tested 5 records


 


 


Seems like a common issue.


Share this post


Link to post
Share on other sites

  • 1 month later...

I have tested to import the procuts in localhost in Prestashop version 1.5.4 and it worked perfect!

 

So that means Prestashop 1.5.5 does not work with csv import for products!!

 

Please can someone help me and all the other people who upgraded to fix this?!

 

Hello,

  I also have some problem with CSV import - images are not imported (localhost and live server). Please, would you be so kind and send me a CSV sample file, that is 100% working? I will try it on my localhost and then on my live server.

 

 

Thank you very much

Share this post


Link to post
Share on other sites

  • 4 years later...
  • 2 years later...
  • 1 year later...

In my case, it was a problem with SSL certificate verification. Tools::file_get_contents() method is wrong constructed.

For the time of importing, I changed the code like this:

# /classes/Tools.php

    public static function copy($source, $destination, $stream_context = null)
    {
        if (null === $stream_context && !preg_match('/^https?:\/\//', $source)) {
            return @copy($source, $destination);
        }

        // OLD: return @file_put_contents($destination, Tools::file_get_contents($source, false, $stream_context));
        // NEW:
        return @file_put_contents($destination, file_get_contents($source, false, stream_context_create(array(
            'ssl' => array(
                'verify_peer' => false,
                'verify_peer_name' => false,
            ),
        ))));
    }

Hope this helps someone 🙂

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More