I want to copy a file which is in a folder and copy to pub/media/product folder for product image... my current file directory pub/media/xyz/images/i/j/ijk.jpeg . i want this image to product folder. how to get that using php?

  • You can also do copy all folder and file like:cp -r pub/media/xyz/images/* pub/media/catalog/product/ << so that copy your whole folder pub/media/xyz/images/i Jun 30, 2021 at 5:44

2 Answers 2


use below ssh command to copy file to other folder

cp pub/media/xyz/images/i/j/ijk.jpeg pub/media/product

PHP Function

$file = 'example.txt';
$newfile = 'example.txt.bak';

copy($file, $newfile)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.