protected function FileBlob::putFile in Migrate Plus 8.5
Same name and namespace in other branches
- 8.2 src/Plugin/migrate/process/FileBlob.php \Drupal\migrate_plus\Plugin\migrate\process\FileBlob::putFile()
- 8.3 src/Plugin/migrate/process/FileBlob.php \Drupal\migrate_plus\Plugin\migrate\process\FileBlob::putFile()
- 8.4 src/Plugin/migrate/process/FileBlob.php \Drupal\migrate_plus\Plugin\migrate\process\FileBlob::putFile()
Try to save the file.
Parameters
string $destination: The destination path or URI.
string $blob: The base64 encoded file contents.
int $replace: (optional) either FileSystemInterface::EXISTS_REPLACE; (default) or FileSystemInterface::EXISTS_ERROR, depending on the configuration.
Return value
bool|string File path on success, FALSE on failure.
1 call to FileBlob::putFile()
- FileBlob::transform in src/
Plugin/ migrate/ process/ FileBlob.php - Performs the associated process.
File
- src/
Plugin/ migrate/ process/ FileBlob.php, line 161
Class
- FileBlob
- Copy a file from a blob into a file.
Namespace
Drupal\migrate_plus\Plugin\migrate\processCode
protected function putFile($destination, $blob, $replace = FileSystemInterface::EXISTS_REPLACE) {
$path = $this->fileSystem
->getDestinationFilename($destination, $replace);
if ($path) {
if (file_put_contents($path, $blob)) {
return $path;
}
else {
return FALSE;
}
}
// File was already copied.
return $destination;
}