I'm migrating images from URLs and I'm mapping the image field with this code:
$this->addFieldMapping('field_image', 'titlePhotos')
->xpath('/photo/@URL');
$this->addFieldMapping('field_image:source_dir')
->defaultValue(DRUPAL_ROOT . '/sites/default/files/images');
$this->addFieldMapping('field_image:file_class')
->defaultValue('MigrateFileUri');
I want to overwrite files if they already exit when running the migration for the first time and on update.
I'm using Drupal 7.