-1

I try to copy some files from one directory on server to another, but it does not work.

Here is my code:

system('cp /var/www/site1/images/' . $row['imageUrl']. ' /var/www/site2/content/upload/content/item/mid/' . $row['imageUrl']);
nowiko
  • 2,507
  • 6
  • 38
  • 82

1 Answers1

0
$file = '/var/www/site1/images/'.$row['imageUpl'];
$newfile = '/var/www/site2/content/upload/content/item/mid/'.$row['imageUpl'];

if (copy($file, $newfile)) {
    echo "success";
}
else
{
    echo "failed";
}

Look at the copy() function here: http://php.net/manual/ru/function.copy.php

Kolja
  • 860
  • 4
  • 10
  • 30
John V
  • 875
  • 6
  • 12