public function saveFile($file_name) {
    $path = 'public://govcms8-demo';
    if (file_prepare_directory($path, FILE_CREATE_DIRECTORY)) {
      $source = DRUPAL_ROOT . '/' . drupal_get_path('module', 'govcms8_default_content') . '/import/images/' . $file_name;
      $data = file_get_contents($source);
      return file_save_data($data, "public://govcms8-demo/" . $file_name, FILE_EXISTS_RENAME);
    }
  }
public function saveFile($file_name) {
    $path = 'public://govcms8-demo';
    if (file_prepare_directory($path, FILE_CREATE_DIRECTORY)) {
      $source = DRUPAL_ROOT . '/' . drupal_get_path('module', 'govcms8_default_content') . '/import/images/' . $file_name;
      $data = file_get_contents($source);
      return file_save_data($data, "public://govcms8-demo/" . $file_name, FILE_EXISTS_RENAME);
    }
  }
public function saveFile ( $ file_name ) { $ path = 'public://govcms8-demo' ; if ( file_prepare_directory ( $ path , FILE_CREATE_DIRECTORY ) ) { $ source = DRUPAL_ROOT . '/' . drupal_get_path ( 'module' , 'govcms8_default_content' ) . '/import/images/' . $ file_name ; $ data = file_get_contents ( $ source ) ; return file_save_data ( $ data , "public://govcms8-demo/" . $ file_name , FILE_EXISTS_RENAME ) ; } }
Save a file during the media import.
Save a file during the media import .